LBJ2.parse
Class LineByLine

java.lang.Object
  extended by LBJ2.parse.LineByLine
All Implemented Interfaces:
Parser
Direct Known Subclasses:
ColumnFormat, POSBracketToVector, SentenceSplitter

public abstract class LineByLine
extends java.lang.Object
implements Parser

This abstract 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.


Field Summary
protected  java.lang.String fileName
          The name of the file to parse.
protected  java.io.BufferedReader in
          Reader for file currently being parsed.
 
Constructor Summary
protected LineByLine()
          Leaves the member variables uninitialized.
  LineByLine(java.lang.String file)
          Creates the parser.
 
Method Summary
protected  java.lang.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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface LBJ2.parse.Parser
next
 

Field Detail

in

protected java.io.BufferedReader in
Reader for file currently being parsed.


fileName

protected java.lang.String fileName
The name of the file to parse.

Constructor Detail

LineByLine

protected LineByLine()
Leaves the member variables uninitialized.


LineByLine

public LineByLine(java.lang.String file)
Creates the parser.

Parameters:
file - The name of the file to parse.
Method Detail

readLine

protected java.lang.String readLine()
Reads a line from the current buffer and returns it. When there are no more lines in the input file, the stream is closed, and null will be returned by this method thereafter. Returned strings do not contain line termination characters.

Returns:
The next line of text from the input file, or null if not more lines remain.

reset

public void reset()
Sets this parser back to the beginning of the raw data.

Specified by:
reset in interface Parser