public class CaptureStreamHandler extends Object implements org.apache.tools.ant.taskdefs.ExecuteStreamHandler
| Constructor and Description |
|---|
CaptureStreamHandler() |
| Modifier and Type | Method and Description |
|---|---|
static CaptureStreamHandler |
execute(String[] cmdline)
Executes the given command, capturing the output using a newly allocated
CaptureStreamHandler, which is then returned. |
void |
gatherOutput()
Reads concurrently both the process standard output and standard error.
|
String[] |
getOutput()
Gets the output of the execution.
|
String[] |
getStderr()
Gets the output of the execution's standard error stream.
|
String[] |
getStdout()
Gets the output of the execution's standard output stream.
|
static String[] |
run(String[] cmdline)
Runs an executable and captures the output in a String array
|
void |
setProcessErrorStream(InputStream is)
Install a handler for the error stream of the subprocess.
|
void |
setProcessInputStream(OutputStream os)
Install a handler for the input stream of the subprocess.
|
void |
setProcessOutputStream(InputStream is)
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.
|
public static CaptureStreamHandler execute(String[] cmdline)
CaptureStreamHandler, which is then returned.
In contrast to run(String[]), this method allows both the standard
error and standard output streams to be inspected after execution (via the
getStderr() and getStdout() methods, respectively).
cmdline - command line argumentsCaptureStreamHandler used to capture the output.public static String[] run(String[] cmdline)
cmdline - command line argumentsgetOutput()public void gatherOutput()
public String[] getOutput()
public String[] getStderr()
public String[] getStdout()
public void setProcessErrorStream(InputStream is) throws IOException
setProcessErrorStream in interface org.apache.tools.ant.taskdefs.ExecuteStreamHandleris - input stream to read from the error stream from the subprocessIOExceptionpublic void setProcessInputStream(OutputStream os) throws IOException
setProcessInputStream in interface org.apache.tools.ant.taskdefs.ExecuteStreamHandleros - output stream to write to the standard input stream of the
subprocessIOExceptionpublic void setProcessOutputStream(InputStream is) throws IOException
setProcessOutputStream in interface org.apache.tools.ant.taskdefs.ExecuteStreamHandleris - input stream to read from the error stream from the subprocessIOExceptionpublic void start()
throws IOException
start in interface org.apache.tools.ant.taskdefs.ExecuteStreamHandlerIOExceptionpublic void stop()
stop in interface org.apache.tools.ant.taskdefs.ExecuteStreamHandlerCopyright © 2005-2016 NAR Maven Plugin developers. All Rights Reserved.