Package eu.simuline.octave.util
Class ReaderWriterPipeThread
- java.lang.Object
-
- java.lang.Thread
-
- eu.simuline.octave.util.ReaderWriterPipeThread
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
-
-
Field Summary
Fields Modifier and Type Field Description private static char[]
BUF
private static org.apache.commons.logging.Log
LOG
private Reader
reader
private Writer
writer
-
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
-
-
Constructor Summary
Constructors Modifier Constructor Description private
ReaderWriterPipeThread(Reader reader, Writer writer)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Close the thread.static ReaderWriterPipeThread
instantiate(Reader reader, Writer writer)
Will create a thread that reads from reader and writes to write until reader reaches EOF.void
run()
void
setWriter(Writer writer)
-
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
-
-
-
-
Method Detail
-
instantiate
public static ReaderWriterPipeThread instantiate(Reader reader, Writer writer)
Will create a thread that reads from reader and writes to write until reader reaches EOF. Then the thread will close. Remember to join() this thread before closing reader or writer.- Parameters:
reader
-writer
- may be null TBC: does this make sense?- Returns:
- Returns the new thread
-
setWriter
public void setWriter(Writer writer)
- Parameters:
writer
- the writer to set This may be null TBC
-
close
public void close()
Close the thread.
-
-