public class StreamGobbler
extends java.lang.Thread
Process
, the input and error streams must read even
if the data written to these streams is not used by the application.
The generally accepted solution for this problem is a stream gobbler thread
that does nothing but consume data from an input stream until stopped.Modifier and Type | Field and Description |
---|---|
protected boolean |
end |
protected java.io.InputStream |
is |
protected java.lang.Object |
lock |
protected java.io.OutputStream |
out |
protected java.lang.String |
prefix |
Constructor and Description |
---|
StreamGobbler(java.io.InputStream is) |
StreamGobbler(java.io.InputStream is,
java.io.OutputStream output) |
StreamGobbler(java.io.InputStream is,
java.io.OutputStream output,
java.lang.String prefix) |
Modifier and Type | Method and Description |
---|---|
void |
run() |
void |
waitFor()
Waits for gobbler to end.
|
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
protected final java.io.InputStream is
protected final java.lang.String prefix
protected final java.io.OutputStream out
protected final java.lang.Object lock
protected boolean end
Copyright © 2003-present Jodd Team