Class CaptureStreamHandler
- java.lang.Object
-
- net.sf.antcontrib.cpptasks.compiler.CaptureStreamHandler
-
- All Implemented Interfaces:
org.apache.tools.ant.taskdefs.ExecuteStreamHandler
public class CaptureStreamHandler extends java.lang.Object implements org.apache.tools.ant.taskdefs.ExecuteStreamHandlerImplements ExecuteStreamHandler to capture the output of a Execute to an array of strings- Author:
- Curt Arnold
-
-
Constructor Summary
Constructors Constructor Description CaptureStreamHandler()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String[]getOutput()static java.lang.String[]run(java.lang.String[] cmdline)Runs an executable and captures the output in a String arrayvoidsetProcessErrorStream(java.io.InputStream is)Install a handler for the error stream of the subprocess.voidsetProcessInputStream(java.io.OutputStream os)Install a handler for the input stream of the subprocess.voidsetProcessOutputStream(java.io.InputStream is)Install a handler for the output stream of the subprocess.voidstart()Start handling of the streams.voidstop()Stop handling of the streams - will not be restarted.
-
-
-
Method Detail
-
run
public static java.lang.String[] run(java.lang.String[] cmdline)
Runs an executable and captures the output in a String array- Parameters:
cmdline- command line arguments- Returns:
- output of process
-
getOutput
public java.lang.String[] getOutput()
-
setProcessErrorStream
public void setProcessErrorStream(java.io.InputStream is) throws java.io.IOExceptionInstall a handler for the error stream of the subprocess.- Specified by:
setProcessErrorStreamin interfaceorg.apache.tools.ant.taskdefs.ExecuteStreamHandler- Parameters:
is- input stream to read from the error stream from the subprocess- Throws:
java.io.IOException
-
setProcessInputStream
public void setProcessInputStream(java.io.OutputStream os) throws java.io.IOExceptionInstall a handler for the input stream of the subprocess.- Specified by:
setProcessInputStreamin interfaceorg.apache.tools.ant.taskdefs.ExecuteStreamHandler- Parameters:
os- output stream to write to the standard input stream of the subprocess- Throws:
java.io.IOException
-
setProcessOutputStream
public void setProcessOutputStream(java.io.InputStream is) throws java.io.IOExceptionInstall a handler for the output stream of the subprocess.- Specified by:
setProcessOutputStreamin interfaceorg.apache.tools.ant.taskdefs.ExecuteStreamHandler- Parameters:
is- input stream to read from the error stream from the subprocess- Throws:
java.io.IOException
-
start
public void start() throws java.io.IOExceptionStart handling of the streams.- Specified by:
startin interfaceorg.apache.tools.ant.taskdefs.ExecuteStreamHandler- Throws:
java.io.IOException
-
stop
public void stop()
Stop handling of the streams - will not be restarted.- Specified by:
stopin interfaceorg.apache.tools.ant.taskdefs.ExecuteStreamHandler
-
-