public abstract class LineByLine extends Object implements Parser
Parser
does not define the next()
method, but it does
define a constructor that opens the specified file and a readLine()
method that
fetches the next line of text from that file, taking care of exception handling.Modifier and Type | Field and Description |
---|---|
protected String |
fileName
The name of the file to parse.
|
protected BufferedReader |
in
Reader for file currently being parsed.
|
Modifier | Constructor and Description |
---|---|
protected |
LineByLine()
Leaves the member variables uninitialized.
|
|
LineByLine(String file)
Creates the parser.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Frees any resources this parser may be holding.
|
protected String |
readLine()
Reads a line from the current buffer and returns it.
|
void |
reset()
Sets this parser back to the beginning of the raw data.
|
protected BufferedReader in
protected String fileName
protected LineByLine()
public LineByLine(String file)
file
- The name of the file to parse.protected String readLine()
null
will be returned by this method
thereafter. Returned strings do not contain line termination characters.null
if no more lines
remain.public void reset()
Copyright © 2016. All rights reserved.