Package org.apache.tools.ant.taskdefs
Class PumpStreamHandler
java.lang.Object
org.apache.tools.ant.taskdefs.PumpStreamHandler
- All Implemented Interfaces:
- ExecuteStreamHandler
- Direct Known Subclasses:
- JUnitTask.JUnitLogStreamHandler,- LogStreamHandler
Copies standard output and error of subprocesses to standard output and
 error of the parent process.
- Since:
- Ant 1.2
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionprotected static classSpecialized subclass that allows access to the running StreamPumper.
- 
Constructor SummaryConstructorsConstructorDescriptionConstruct a newPumpStreamHandler.PumpStreamHandler(OutputStream outAndErr) Construct a newPumpStreamHandler.PumpStreamHandler(OutputStream out, OutputStream err) Construct a newPumpStreamHandler.PumpStreamHandler(OutputStream out, OutputStream err, InputStream input) Construct a newPumpStreamHandler.PumpStreamHandler(OutputStream out, OutputStream err, InputStream input, boolean nonBlockingRead) Construct a newPumpStreamHandler.
- 
Method SummaryModifier and TypeMethodDescriptionprotected voidCreate the pump to handle error output.protected voidCreate the pump to handle process output.protected ThreadcreatePump(InputStream is, OutputStream os) Creates a stream pumper to copy the given input stream to the given output stream.protected ThreadcreatePump(InputStream is, OutputStream os, boolean closeWhenExhausted) Creates a stream pumper to copy the given input stream to the given output stream.protected ThreadcreatePump(InputStream is, OutputStream os, boolean closeWhenExhausted, boolean nonBlockingIO) Creates a stream pumper to copy the given input stream to the given output stream.protected final voidWaits for a thread to finish while trying to make it finish quicker by stopping the pumper (if the thread is aThreadWithPumperinstance) or interrupting the thread.protected OutputStreamgetErr()Get the error stream.protected OutputStreamgetOut()Get the output stream.voidSet theInputStreamfrom which to read the standard error of the process.voidSet theOutputStreamby means of which input can be sent to the process.voidSet theInputStreamfrom which to read the standard output of the process.voidstart()Start theThreads.voidstop()Stop pumping the streams.
- 
Constructor Details- 
PumpStreamHandlerpublic PumpStreamHandler(OutputStream out, OutputStream err, InputStream input, boolean nonBlockingRead) Construct a newPumpStreamHandler.- Parameters:
- out- the output- OutputStream, must not be null.
- err- the error- OutputStream, must not be null.
- input- the input- InputStream.
- nonBlockingRead- set it to- trueif the input should be read with simulated non blocking IO.
 
- 
PumpStreamHandlerConstruct a newPumpStreamHandler.- Parameters:
- out- the output- OutputStream, must not be null.
- err- the error- OutputStream, must not be null.
- input- the input- InputStream.
 
- 
PumpStreamHandlerConstruct a newPumpStreamHandler.- Parameters:
- out- the output- OutputStream, must not be null.
- err- the error- OutputStream, must not be null.
 
- 
PumpStreamHandlerConstruct a newPumpStreamHandler.- Parameters:
- outAndErr- the output/error- OutputStream, must not be null.
 
- 
PumpStreamHandlerpublic PumpStreamHandler()Construct a newPumpStreamHandler.
 
- 
- 
Method Details- 
setProcessOutputStreamSet theInputStreamfrom which to read the standard output of the process.- Specified by:
- setProcessOutputStreamin interface- ExecuteStreamHandler
- Parameters:
- is- the- InputStream.
 
- 
setProcessErrorStreamSet theInputStreamfrom which to read the standard error of the process.- Specified by:
- setProcessErrorStreamin interface- ExecuteStreamHandler
- Parameters:
- is- the- InputStream.
 
- 
setProcessInputStreamSet theOutputStreamby means of which input can be sent to the process.- Specified by:
- setProcessInputStreamin interface- ExecuteStreamHandler
- Parameters:
- os- the- OutputStream.
 
- 
start
- 
stop
- 
finishWaits for a thread to finish while trying to make it finish quicker by stopping the pumper (if the thread is aThreadWithPumperinstance) or interrupting the thread.- Parameters:
- t- Thread
- Since:
- Ant 1.8.0
 
- 
getErr
- 
getOut
- 
createProcessOutputPumpCreate the pump to handle process output.- Parameters:
- is- the- InputStream.
- os- the- OutputStream.
 
- 
createProcessErrorPumpCreate the pump to handle error output.- Parameters:
- is- the input stream to copy from.
- os- the output stream to copy to.
 
- 
createPumpCreates a stream pumper to copy the given input stream to the given output stream.- Parameters:
- is- the input stream to copy from.
- os- the output stream to copy to.
- Returns:
- a thread object that does the pumping.
 
- 
createPumpCreates a stream pumper to copy the given input stream to the given output stream.- Parameters:
- is- the input stream to copy from.
- os- the output stream to copy to.
- closeWhenExhausted- if true close the inputstream.
- Returns:
- a thread object that does the pumping, subclasses
 should return an instance of ThreadWithPumper.
 
- 
createPumpprotected Thread createPump(InputStream is, OutputStream os, boolean closeWhenExhausted, boolean nonBlockingIO) Creates a stream pumper to copy the given input stream to the given output stream.- Parameters:
- is- the input stream to copy from.
- os- the output stream to copy to.
- closeWhenExhausted- if true close the inputstream.
- nonBlockingIO- set it to- trueto use simulated non blocking IO.
- Returns:
- a thread object that does the pumping, subclasses
 should return an instance of ThreadWithPumper.
- Since:
- Ant 1.8.2
 
 
-