Class StreamGobbler
java.lang.Object
java.lang.Thread
jodd.io.StreamGobbler
- All Implemented Interfaces:
Runnable
Consumes a stream.
For any
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.-
Nested Class Summary
Nested classes/interfaces inherited from class Thread
Thread.Builder, Thread.State, Thread.UncaughtExceptionHandler -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprotected final InputStreamprotected final Objectprotected final OutputStreamprotected final StringFields inherited from class Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY -
Constructor Summary
ConstructorsConstructorDescriptionStreamGobbler(InputStream is, OutputStream output) StreamGobbler(InputStream is, OutputStream output, String prefix) -
Method Summary
Methods inherited from class Thread
activeCount, checkAccess, clone, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, isVirtual, join, join, join, join, ofPlatform, ofVirtual, onSpinWait, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, sleep, start, startVirtualThread, stop, threadId, toString, yield
-
Field Details
-
is
-
prefix
-
out
-
lock
-
end
protected boolean end
-
-
Constructor Details
-
StreamGobbler
-
StreamGobbler
-
StreamGobbler
-
-
Method Details
-
run
-
waitFor
public void waitFor()Waits for gobbler to end.
-