public class ProcessWrapper extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
ProcessWrapper.StdXXXLineListener |
| Constructor and Description |
|---|
ProcessWrapper(ProcessBuilder processBuilder) |
| Modifier and Type | Method and Description |
|---|---|
void |
destroy() |
int |
getExitValue() |
boolean |
isRunning() |
ProcessWrapper |
start(ProcessWrapper.StdXXXLineListener newStdOutLineListener)
Start the wrapped process now.
|
int |
waitFor()
Causes the current thread to wait, if necessary, until the process represented by this
Process object has terminated. |
boolean |
waitUntilFinished(int timeOut,
TimeUnit timeUnit) |
public ProcessWrapper(ProcessBuilder processBuilder)
public ProcessWrapper start(ProcessWrapper.StdXXXLineListener newStdOutLineListener) throws IOException
newStdOutLineListener - optional a listener to stdout and stderrIOException - if program can not be started. (Eg: the program does not exist on file system or location)public boolean isRunning()
public boolean waitUntilFinished(int timeOut,
TimeUnit timeUnit)
timeOut - timeUnit - true if process ends before given timeout. Otherwise false if the process is stopped due to running
out of timeout.public int getExitValue()
public void destroy()
public int waitFor()
throws InterruptedException
Process object has terminated. This
method returns immediately if the subprocess has already terminated. If the subprocess has not yet terminated, the calling thread
will be blocked until the subprocess exits.Process object. By convention, the value 0 indicates
normal termination.InterruptedException - if the current thread is interrupted by another thread while it is waiting, then the wait
is ended and an InterruptedException is thrown.Copyright © 2017 LeanIX GmbH. All rights reserved.