ExecuteStreamHandlerpublic class PumpStreamHandler extends java.lang.Object implements ExecuteStreamHandler
| Constructor | Description |
|---|---|
PumpStreamHandler() |
Construct a new
PumpStreamHandler. |
PumpStreamHandler(java.io.OutputStream outAndErr) |
Construct a new
PumpStreamHandler. |
PumpStreamHandler(java.io.OutputStream out,
java.io.OutputStream err) |
Construct a new
PumpStreamHandler. |
PumpStreamHandler(java.io.OutputStream out,
java.io.OutputStream err,
java.io.InputStream input) |
Construct a new
PumpStreamHandler. |
| Modifier and Type | Method | Description |
|---|---|---|
protected void |
createProcessErrorPump(java.io.InputStream is,
java.io.OutputStream os) |
Create the pump to handle error output.
|
protected void |
createProcessOutputPump(java.io.InputStream is,
java.io.OutputStream os) |
Create the pump to handle process output.
|
protected java.lang.Thread |
createPump(java.io.InputStream is,
java.io.OutputStream os) |
Creates a stream pumper to copy the given input stream to the given
output stream.
|
protected java.lang.Thread |
createPump(java.io.InputStream is,
java.io.OutputStream os,
boolean closeWhenExhausted) |
Creates a stream pumper to copy the given input stream to the given
output stream.
|
protected java.io.OutputStream |
getErr() |
Get the error stream.
|
protected java.io.OutputStream |
getOut() |
Get the output stream.
|
void |
setProcessErrorStream(java.io.InputStream is) |
Set the
InputStream from which to read the standard error
of the process. |
void |
setProcessInputStream(java.io.OutputStream os) |
Set the
OutputStream by means of which input can be sent
to the process. |
void |
setProcessOutputStream(java.io.InputStream is) |
Set the
InputStream from which to read the standard output
of the process. |
void |
setStopTimeout(long timeout) |
Set maximum time to wait until output streams are exchausted
when
stop() was called. |
void |
start() |
Start the
Threads. |
void |
stop() |
Stop pumping the streams.
|
protected void |
stopThread(java.lang.Thread thread,
long timeout) |
Stopping a pumper thread.
|
public PumpStreamHandler()
PumpStreamHandler.public PumpStreamHandler(java.io.OutputStream outAndErr)
PumpStreamHandler.outAndErr - the output/error OutputStream.public PumpStreamHandler(java.io.OutputStream out, java.io.OutputStream err)
PumpStreamHandler.out - the output OutputStream.err - the error OutputStream.public PumpStreamHandler(java.io.OutputStream out, java.io.OutputStream err, java.io.InputStream input)
PumpStreamHandler.out - the output OutputStream.err - the error OutputStream.input - the input InputStream.public void setStopTimeout(long timeout)
stop() was called.timeout - timeout in milliseconds or zero to wait forever (default)public void setProcessOutputStream(java.io.InputStream is)
InputStream from which to read the standard output
of the process.setProcessOutputStream in interface ExecuteStreamHandleris - the InputStream.public void setProcessErrorStream(java.io.InputStream is)
InputStream from which to read the standard error
of the process.setProcessErrorStream in interface ExecuteStreamHandleris - the InputStream.public void setProcessInputStream(java.io.OutputStream os)
OutputStream by means of which input can be sent
to the process.setProcessInputStream in interface ExecuteStreamHandleros - the OutputStream.public void start()
Threads.start in interface ExecuteStreamHandlerpublic void stop() throws java.io.IOException
stop in interface ExecuteStreamHandlerjava.io.IOException - thrown when an I/O exception occurs.protected java.io.OutputStream getErr()
OutputStream.protected java.io.OutputStream getOut()
OutputStream.protected void createProcessOutputPump(java.io.InputStream is, java.io.OutputStream os)
is - the InputStream.os - the OutputStream.protected void createProcessErrorPump(java.io.InputStream is, java.io.OutputStream os)
is - the InputStream.os - the OutputStream.protected java.lang.Thread createPump(java.io.InputStream is, java.io.OutputStream os)
is - the input stream to copy fromos - the output stream to copy intoprotected java.lang.Thread createPump(java.io.InputStream is, java.io.OutputStream os, boolean closeWhenExhausted)
is - the input stream to copy fromos - the output stream to copy intocloseWhenExhausted - close the output stream when the input stream is exhaustedprotected void stopThread(java.lang.Thread thread, long timeout)
thread - the thread to be stoppedtimeout - the time in ms to wait to join