Package org.marketcetera.util.exec
Class InputThread
- java.lang.Object
-
- java.lang.Thread
-
- org.marketcetera.util.exec.InputThread
-
-
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 booleanmCloseOutprivate StringmCommandprivate InputStreammInprivate OutputStreammOut-
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
-
-
Constructor Summary
Constructors Constructor Description InputThread(String command, InputStream in, OutputStream out, boolean closeOut)Creates a new thread that consumes the given input stream of a process (which is fed by the standard output stream of the process).
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidrun()-
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
-
-
-
-
Field Detail
-
mCommand
private String mCommand
-
mIn
private InputStream mIn
-
mOut
private OutputStream mOut
-
mCloseOut
private boolean mCloseOut
-
-
Constructor Detail
-
InputThread
InputThread(String command, InputStream in, OutputStream out, boolean closeOut)
Creates a new thread that consumes the given input stream of a process (which is fed by the standard output stream of the process). The input stream is copied to the given output stream in its entirety. Upon completion (successful or not), the input stream is closed; the output stream may also be closed depending on the given setting. I/O errors are logged, and the log messages include the given command that initiated the process.- Parameters:
command- The process command.in- The input stream (standard output stream of the process).out- The output stream.closeOut- True if the output stream should be closed.
-
-