java.lang.Object | +--TextFileReader
The TextFileReader class is an actor class which reads
input from a specified file one sentence at a time.
Sentences are assumed to be terminated with one of the
following characters: '.', ':', ';', '?'
or '!'.
To read input from a file named TestInput.txt,
create a TextFileReader as follows:
Once a TextFileReader has been created, each call
to the nextSentence method returns a new Sentence
object containing the next sentence from the input
file. Once all sentences have been read, the
nextSentence method returns null.
Thus, the following
code would read every sentence in the TestInput.txt
file:
| Constructor Summary | |
TextFileReader(String filename)
Construct a new TextFileReader to be used to read sentences from the specified file. |
|
| Method Summary | |
Sentence |
nextSentence()
Get the next Sentence from the file associated with this TextFileReader. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public TextFileReader(String filename)
filename - the filename of the file from which
to read sentences.| Method Detail |
public Sentence nextSentence()