public class PumpStreamHandler extends Object implements ExecuteStreamHandler
Constructor and Description |
---|
PumpStreamHandler()
Construct a new
PumpStreamHandler . |
PumpStreamHandler(OutputStream outAndErr)
Construct a new
PumpStreamHandler . |
PumpStreamHandler(OutputStream out,
OutputStream err)
Construct a new
PumpStreamHandler . |
PumpStreamHandler(OutputStream out,
OutputStream err,
InputStream input)
Construct a new
PumpStreamHandler . |
Modifier and Type | Method and Description |
---|---|
protected void |
createProcessErrorPump(InputStream is,
OutputStream os)
Create the pump to handle error output.
|
protected void |
createProcessOutputPump(InputStream is,
OutputStream os)
Create the pump to handle process output.
|
protected Thread |
createPump(InputStream is,
OutputStream os)
Creates a stream pumper to copy the given input stream to the given
output stream.
|
protected Thread |
createPump(InputStream is,
OutputStream os,
boolean closeWhenExhausted)
Creates a stream pumper to copy the given input stream to the given
output stream.
|
protected OutputStream |
getErr()
Get the error stream.
|
protected OutputStream |
getOut()
Get the output stream.
|
void |
setProcessErrorStream(InputStream is)
Set the
InputStream from which to read the standard error
of the process. |
void |
setProcessInputStream(OutputStream os)
Set the
OutputStream by means of which input can be sent
to the process. |
void |
setProcessOutputStream(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
Thread s. |
void |
stop()
Stop pumping the streams.
|
protected void |
stopThread(Thread thread,
long timeout)
Stopping a pumper thread.
|
public PumpStreamHandler()
PumpStreamHandler
.public PumpStreamHandler(OutputStream outAndErr)
PumpStreamHandler
.outAndErr
- the output/error OutputStream
.public PumpStreamHandler(OutputStream out, OutputStream err)
PumpStreamHandler
.out
- the output OutputStream
.err
- the error OutputStream
.public PumpStreamHandler(OutputStream out, OutputStream err, 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(InputStream is)
InputStream
from which to read the standard output
of the process.setProcessOutputStream
in interface ExecuteStreamHandler
is
- the InputStream
.public void setProcessErrorStream(InputStream is)
InputStream
from which to read the standard error
of the process.setProcessErrorStream
in interface ExecuteStreamHandler
is
- the InputStream
.public void setProcessInputStream(OutputStream os)
OutputStream
by means of which input can be sent
to the process.setProcessInputStream
in interface ExecuteStreamHandler
os
- the OutputStream
.public void start()
Thread
s.start
in interface ExecuteStreamHandler
public void stop() throws IOException
stop
in interface ExecuteStreamHandler
IOException
protected OutputStream getErr()
OutputStream
.protected OutputStream getOut()
OutputStream
.protected void createProcessOutputPump(InputStream is, OutputStream os)
is
- the InputStream
.os
- the OutputStream
.protected void createProcessErrorPump(InputStream is, OutputStream os)
is
- the InputStream
.os
- the OutputStream
.protected Thread createPump(InputStream is, OutputStream os)
is
- the input stream to copy fromos
- the output stream to copy intoprotected Thread createPump(InputStream is, 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(Thread thread, long timeout)
thread
- the thread to be stoppedtimeout
- the time in ms to wait to joinCopyright © 2014 The Apache Software Foundation. All rights reserved.