|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--TextFileRead
This example program reads lines of text from a file and writes them on the console window.
| Constructor Summary | |
TextFileRead(java.lang.String fn)
Create a new TextFileRead object with which to read a file. |
|
| Method Summary | |
void |
close()
Close the stream. |
java.lang.String |
getNextLine()
Read one line from the text file and return it as a String to the caller. |
java.lang.String |
getNextNonBlankLine()
Read one line from the text file and return it as a String to the caller. |
static void |
main(java.lang.String[] arg)
Test harness for this class. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public TextFileRead(java.lang.String fn)
throws java.io.IOException
fn - the name of the file to read.
java.io.IOException - if there is an error opening the file| Method Detail |
public java.lang.String getNextLine()
throws java.io.IOException
java.io.IOException - if there is an error reading the file
public java.lang.String getNextNonBlankLine()
throws java.io.IOException
java.io.IOException - if there is an error reading the file
public void close()
throws java.io.IOException
java.io.IOException - if there is an error closing the file
public static void main(java.lang.String[] arg)
throws java.io.IOException
arg - arg[0] name of the file to read. Defaults to
sampleIn.txt if not specified.
java.io.IOException - if there is an error performing any I/O
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||