Package com.sun.javatest.util
Class LineParser
java.lang.Object
com.sun.javatest.util.LineParser
A class to parse lines of words in a stream. Words may be unquoted sequences
of non-blank characters, or may be quoted strings. Comments can be introduced
by '#' and extend to the next newline character. Lines may be terminated
by newline, semicolon or a comment.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
This exception is used to report problems while using a line parser. -
Constructor Summary
ConstructorsConstructorDescriptionLineParser
(File file) Create a line parser, reading the data in a given file.LineParser
(Reader in) Create a line parser, reading data from an anonymous stream. -
Method Summary
-
Constructor Details
-
LineParser
Create a line parser, reading the data in a given file.- Parameters:
file
- the file to be read- Throws:
FileNotFoundException
- if the file was not foundIOException
- if there is some problem opening the file or reading the initial characters of the file
-
LineParser
Create a line parser, reading data from an anonymous stream.- Parameters:
in
- the stream from which to read the data
-
-
Method Details
-
getFile
Get the file being read, or null if it is not available.- Returns:
- the file being read, or null if not available
-
getLineNumber
public int getLineNumber()Get the current line number within the stream being read.- Returns:
- the current line number within nthe stream being read
-
readLine
Read the next line of words from the input stream.- Returns:
- the next line of words from the input stream
- Throws:
LineParser.Fault
- if there is a problem reading the required data -- such as an unterminated string
-