ParkNPark.tests
Class InputCopier
java.lang.Object
java.lang.Thread
ParkNPark.tests.InputCopier
- All Implemented Interfaces:
- Runnable
- Direct Known Subclasses:
- ClientInputCopier, ErrorCopier, ServerInputCopier
class InputCopier
- extends Thread
Copies lines from a Reader to a Writer, one line at a time,
as a background Thread
|
Method Summary |
protected void |
lineProcessed(String line)
Called after a line has been written to the writer |
protected void |
processingFinished()
Called when the processing finishes, just before
the reader and writer are closed |
protected String |
processLine(String line)
Processes the given line and returns the line that should
be written to the writer or null if the copier
should stop copying |
void |
run()
Copies lines from the reader to the writer |
| Methods inherited from class java.lang.Thread |
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
reader
protected BufferedReader reader
writer
protected BufferedWriter writer
InputCopier
public InputCopier(Reader reader,
Writer writer)
processLine
protected String processLine(String line)
- Processes the given line and returns the line that should
be written to the writer or null if the copier
should stop copying
- Parameters:
line - The line returned from the reader
- Returns:
- The line to write to the writer or null if the
copier should stop copying
processingFinished
protected void processingFinished()
- Called when the processing finishes, just before
the reader and writer are closed
lineProcessed
protected void lineProcessed(String line)
- Called after a line has been written to the writer
- Parameters:
line - The line that was written to the writer
run
public void run()
- Copies lines from the reader to the writer
- Specified by:
run in interface Runnable- Overrides:
run in class Thread