@ThreadSafe public class DefaultProcessExecutor extends Object implements ProcessExecutor
Modifier and Type | Class and Description |
---|---|
class |
DefaultProcessExecutor.DefaultConsoleOutput |
ProcessExecutor.ConsoleOutput
Constructor and Description |
---|
DefaultProcessExecutor() |
Modifier and Type | Method and Description |
---|---|
static DefaultProcessExecutor |
forExecutable(String executable)
Factory method for associating an executable.
|
DefaultProcessExecutor |
send(String string)
Sends a string to the stdin of the running process.
|
DefaultProcessExecutor |
start()
Starts the external process.
|
void |
stop()
Stops the external process.
|
DefaultProcessExecutor |
waitForCompletion()
Waits for the termination of the external process.
|
DefaultProcessExecutor |
withArgument(String argument)
Adds a single argument to pass to the external process.
|
DefaultProcessExecutor |
withArguments(String... arguments)
Adds some arguments to pass to the external process.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getStderr, getStdout
@Nonnull public static DefaultProcessExecutor forExecutable(@Nonnull String executable)
executable
- the executable (with the full path)start()
@Nonnull public DefaultProcessExecutor withArgument(@Nonnull String argument)
withArgument
in interface ProcessExecutor
argument
- the argument@Nonnull public DefaultProcessExecutor withArguments(@Nonnull String... arguments)
withArguments
in interface ProcessExecutor
arguments
- the arguments@Nonnull public DefaultProcessExecutor start() throws IOException
start
in interface ProcessExecutor
IOException
- in case of errorpublic void stop()
stop
in interface ProcessExecutor
@Nonnull public DefaultProcessExecutor waitForCompletion() throws IOException, InterruptedException
waitForCompletion
in interface ProcessExecutor
IOException
- in case of I/O errorInterruptedException
- if the wait has been interrupted@Nonnull public DefaultProcessExecutor send(@Nonnull String string) throws IOException
send
in interface ProcessExecutor
string
- the string to sendIOException
- in case of I/O errorCopyright © 2009–2016 Tidalwave s.a.s. (http://tidalwave.it). All rights reserved.