public class ProcessRunner
extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
ProcessRunner.CommandFailedException
Exception thrown if an external command ends with a non-zero exit
status.
|
private static class |
ProcessRunner.InputStuffer
Class to stuff input into the process's input stream (an OutputStream to
us).
|
private static class |
ProcessRunner.Interrupter
Used to interrupt the main thread if a timeout occurs
|
private static class |
ProcessRunner.OutputGrabber
Class to accumulate the output from a process's output stream (which is
an InputStream to us), and turn it into a string.
|
| Constructor and Description |
|---|
ProcessRunner() |
| Modifier and Type | Method and Description |
|---|---|
static byte[] |
runAndGrab(String[] argArray,
byte[] inputBytes,
int timeout)
Run the external process, applying a timeout if specified, feeding it
input on stdin and gathering the results from stdout.
|
static String |
runAndGrab(String[] argArray,
String input,
int timeout)
Run the external process, applying a timeout if specified, feeding it
input on stdin and gathering the results from stdout.
|
public static String runAndGrab(String[] argArray,
String input,
int timeout)
throws InterruptedException,
ProcessRunner.CommandFailedException,
IOException
IOException - If something goes wrong starting the process.InterruptedException - If process exceeds the given timeout.ProcessRunner.CommandFailedException - If the process exits with non-zero status.public static byte[] runAndGrab(String[] argArray,
byte[] inputBytes,
int timeout)
throws InterruptedException,
ProcessRunner.CommandFailedException,
IOException
IOException - If something goes wrong starting the process.InterruptedException - If process exceeds the given timeout.ProcessRunner.CommandFailedException - If the process exits with non-zero status.