|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.Thread
ParkNPark.tests.InputCopier
class InputCopier
Copies lines from a Reader to a Writer, one line at a time, as a background Thread
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.lang.Thread |
---|
Thread.State, Thread.UncaughtExceptionHandler |
Field Summary | |
---|---|
protected BufferedReader |
reader
|
protected BufferedWriter |
writer
|
Fields inherited from class java.lang.Thread |
---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
---|---|
InputCopier(Reader reader,
Writer writer)
|
Method Summary | |
---|---|
protected void |
closeReader()
Called when the reader is ready to be closed |
protected void |
closeWriter()
Called when the writer is ready to be closed |
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 |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected BufferedReader reader
protected BufferedWriter writer
Constructor Detail |
---|
public InputCopier(Reader reader, Writer writer)
Method Detail |
---|
protected String processLine(String line)
line
- The line returned from the reader
protected void processingFinished()
protected void lineProcessed(String line)
line
- The line that was written to the writerprotected void closeReader()
protected void closeWriter()
public void run()
run
in interface Runnable
run
in class Thread
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |