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.ExecuteStreamHandler
is
- input stream to read from the error stream from the subprocessIOException
public void setProcessInputStream(OutputStream os) throws IOException
setProcessInputStream
in interface org.apache.tools.ant.taskdefs.ExecuteStreamHandler
os
- output stream to write to the standard input stream of the
subprocessIOException
public void setProcessOutputStream(InputStream is) throws IOException
setProcessOutputStream
in interface org.apache.tools.ant.taskdefs.ExecuteStreamHandler
is
- input stream to read from the error stream from the subprocessIOException
public void start() throws IOException
start
in interface org.apache.tools.ant.taskdefs.ExecuteStreamHandler
IOException
public void stop()
stop
in interface org.apache.tools.ant.taskdefs.ExecuteStreamHandler
Copyright © 2005-2016 NAR Maven Plugin developers. All Rights Reserved.