public final class StreamForwarder
extends java.lang.Thread
InputStream
and write it to a
OutputStream
.
A small buffer is used (typically 1 KB) to improve performance. Any exceptions will be ignored.Constructor and Description |
---|
StreamForwarder(java.io.InputStream in,
java.io.OutputStream out)
Create a new StreamForwarder and start it immediately.
|
Modifier and Type | Method and Description |
---|---|
void |
run()
Main entry method for the daemon thread.
|
void |
terminate(long timeout)
Wait for a given timeout for the StreamForwarder to terminate by reading an end-of-stream on the input.
|
activeCount, checkAccess, clone, 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
public StreamForwarder(java.io.InputStream in, java.io.OutputStream out)
in
- the InputStream
to read from.out
- the OutputStream
to write to.public void terminate(long timeout)
timeout
- The number of milliseconds to wait for termination.public void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread