Class AsciiReadSupport
java.lang.Object
cnuphys.magfield.converter.AsciiReadSupport
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringasciiFileToString(File file) Read an entire ascii file into a single string.static intcountLines(File file) Count the lines in an ASCII file, without skipping commentstatic intcountNonCommentLines(File file) Counts the number of non-comment lines in a filestatic StringnextNonComment(BufferedReader bufferedReader) Get the next non comment linestatic String[]nextTokens(BufferedReader bufferedReader) Get the next tokens from a buffered readerstatic voidskipLines(int n, BufferedReader bufferedReader) Skip lines in an ascii filestatic String[]This method breaks a string into an array of tokens.static String[]This method breaks a string into an array of tokens.
-
Field Details
-
commentChar
- See Also:
-
-
Constructor Details
-
AsciiReadSupport
public AsciiReadSupport()
-
-
Method Details
-
nextNonComment
Get the next non comment line- Parameters:
bufferedReader- a buffered reader which should be linked to an ascii file- Returns:
- the next non comment line (or
null)
-
countNonCommentLines
Counts the number of non-comment lines in a file- Parameters:
file- the file in question- Returns:
- the number of non-comment lines in the file
-
asciiFileToString
-
countLines
Count the lines in an ASCII file, without skipping comment- Parameters:
file- the file in question- Returns:
- the number of lines in the file
-
nextTokens
Get the next tokens from a buffered reader- Parameters:
bufferedReader- a buffered reader which should be linked to an ascii file- Returns:
- the next set of white-space separated tokens.
-
tokens
-
tokens
-
skipLines
Skip lines in an ascii file- Parameters:
n- the number of lines to skipbufferedReader- a buffered reader which should be linked to an ascii file
-