Package cnuphys.magfield.converter
Class AsciiReadSupport
java.lang.Object
cnuphys.magfield.converter.AsciiReadSupport
Support for simpe ASCII reads
- Author:
- heddle
- 
Field SummaryFields
- 
Constructor SummaryConstructors
- 
Method SummaryModifier 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- 
AsciiReadSupportpublic AsciiReadSupport()
 
- 
- 
Method Details- 
nextNonCommentGet 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)
 
- 
countNonCommentLinesCounts 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
 
- 
asciiFileToStringRead an entire ascii file into a single string.- Parameters:
- file- the file to read
- Returns:
- the string with the entire content of the file
 
- 
countLinesCount the lines in an ASCII file, without skipping comment- Parameters:
- file- the file in question
- Returns:
- the number of lines in the file
 
- 
nextTokensGet 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.
 
- 
tokensThis method breaks a string into an array of tokens.- Parameters:
- str- the string to decompose.
- delimiter- the delimiter
- Returns:
- an array of tokens
 
- 
tokensThis method breaks a string into an array of tokens.- Parameters:
- str- the string to decompose.
- Returns:
- an array of tokens
 
- 
skipLinesSkip lines in an ascii file- Parameters:
- n- the number of lines to skip
- bufferedReader- a buffered reader which should be linked to an ascii file
 
 
-