Package cnuphys.magfield.converter
Class AsciiReadSupport
java.lang.Object
cnuphys.magfield.converter.AsciiReadSupport
Support for simpe ASCII reads
- Author:
- heddle
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic String
asciiFileToString
(File file) Read an entire ascii file into a single string.static int
countLines
(File file) Count the lines in an ASCII file, without skipping commentstatic int
countNonCommentLines
(File file) Counts the number of non-comment lines in a filestatic String
nextNonComment
(BufferedReader bufferedReader) Get the next non comment linestatic String[]
nextTokens
(BufferedReader bufferedReader) Get the next tokens from a buffered readerstatic void
skipLines
(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
Read an entire ascii file into a single string.- Parameters:
file
- the file to read- Returns:
- the string with the entire content of the file
-
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
This method breaks a string into an array of tokens.- Parameters:
str
- the string to decompose.delimiter
- the delimiter- Returns:
- an array of tokens
-
tokens
This method breaks a string into an array of tokens.- Parameters:
str
- the string to decompose.- Returns:
- an array of 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
-