|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--iglu.util.TextFileProcessor
Basic functionality for classes that perform a pass on a text file. The main advantages of using this class are that you don't need to deal with IOExceptions, and you get a count of the number of lines processed. Passes can be implemented in two ways:
Field Summary | |
private int |
linesRead
|
private java.io.PrintWriter |
output
|
private java.io.BufferedReader |
theReader
|
Constructor Summary | |
TextFileProcessor(java.io.File inputFile,
java.io.File outputFile)
Constructs a simple pass, but doesn't execute it. |
|
TextFileProcessor(java.lang.String inputFile,
java.lang.String outputFile)
Constructs a simple pass, but doesn't execute it. |
Method Summary | |
void |
doPass()
Does the general work of a pass. |
void |
finalizePass()
Closes all open streams and cleans up after the pass. |
int |
getLinesRead()
Returns the number of lines that have been read from the input file. |
java.lang.String |
nextLine()
Returns the next line of text from the input source. |
void |
println(java.lang.String line)
Sends a line of text to the output file. |
void |
processLine(java.lang.String lineOfText)
Takes a line of text and echoes it to the output. |
void |
setInput(java.io.File theFile)
Sets the input for this pass to come from the specified file. |
void |
setInput(java.lang.String filename)
Sets the input for this pass to come from the specified file. |
void |
setOutput(java.io.File theFile)
Sets the output for this pass to go to the specified file. |
void |
setOutput(java.lang.String filename)
Sets the output for this pass to go to the specified file. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private java.io.BufferedReader theReader
private java.io.PrintWriter output
private int linesRead
Constructor Detail |
public TextFileProcessor(java.lang.String inputFile, java.lang.String outputFile) throws java.io.FileNotFoundException
public TextFileProcessor(java.io.File inputFile, java.io.File outputFile) throws java.io.FileNotFoundException
Method Detail |
public void setInput(java.lang.String filename) throws java.io.FileNotFoundException
java.io.FileNotFoundException
public void setInput(java.io.File theFile) throws java.io.FileNotFoundException
java.io.FileNotFoundException
public void setOutput(java.lang.String filename)
public void setOutput(java.io.File theFile)
public final void doPass()
public final java.lang.String nextLine()
public int getLinesRead()
public void println(java.lang.String line)
public void processLine(java.lang.String lineOfText)
public void finalizePass()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |