Class CaptureStreamHandler
java.lang.Object
net.sf.antcontrib.cpptasks.compiler.CaptureStreamHandler
- All Implemented Interfaces:
org.apache.tools.ant.taskdefs.ExecuteStreamHandler
public class CaptureStreamHandler
extends Object
implements org.apache.tools.ant.taskdefs.ExecuteStreamHandler
Implements ExecuteStreamHandler to capture the output of a Execute to an
array of strings
- Author:
- Curt Arnold
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionString[]
static String[]
Runs an executable and captures the output in a String arrayvoid
Install a handler for the error stream of the subprocess.void
Install a handler for the input stream of the subprocess.void
Install a handler for the output stream of the subprocess.void
start()
Start handling of the streams.void
stop()
Stop handling of the streams - will not be restarted.
-
Constructor Details
-
CaptureStreamHandler
public CaptureStreamHandler()
-
-
Method Details
-
run
Runs an executable and captures the output in a String array- Parameters:
cmdline
- command line arguments- Returns:
- output of process
-
getOutput
-
setProcessErrorStream
Install a handler for the error stream of the subprocess.- Specified by:
setProcessErrorStream
in interfaceorg.apache.tools.ant.taskdefs.ExecuteStreamHandler
- Parameters:
is
- input stream to read from the error stream from the subprocess- Throws:
IOException
-
setProcessInputStream
Install a handler for the input stream of the subprocess.- Specified by:
setProcessInputStream
in interfaceorg.apache.tools.ant.taskdefs.ExecuteStreamHandler
- Parameters:
os
- output stream to write to the standard input stream of the subprocess- Throws:
IOException
-
setProcessOutputStream
Install a handler for the output stream of the subprocess.- Specified by:
setProcessOutputStream
in interfaceorg.apache.tools.ant.taskdefs.ExecuteStreamHandler
- Parameters:
is
- input stream to read from the error stream from the subprocess- Throws:
IOException
-
start
Start handling of the streams.- Specified by:
start
in interfaceorg.apache.tools.ant.taskdefs.ExecuteStreamHandler
- Throws:
IOException
-
stop
public void stop()Stop handling of the streams - will not be restarted.- Specified by:
stop
in interfaceorg.apache.tools.ant.taskdefs.ExecuteStreamHandler
-