public final class ProcessLauncher extends Object
Modifier and Type | Class and Description |
---|---|
static class |
ProcessLauncher.CommandNotExistsException
Exception that is thrown when a command could not be executed because it
(probably) does not exist at all.
|
static interface |
ProcessLauncher.OutputListener
Classes implementing this interface can receive output generated by
processes launched using the ProcessLauncher.
|
Constructor and Description |
---|
ProcessLauncher(ArrayList<?> commandList)
Constructs new process launcher with the given command element list.
|
ProcessLauncher(ArrayList<?> commandList,
File baseDir) |
ProcessLauncher(String commandLine)
Constructs a new ProcessLauncher with the given command line.
|
ProcessLauncher(String[] commandArray)
Constructs a new ProcessLauncher with the given command array.
|
ProcessLauncher(String[] commandArray,
File baseDir) |
ProcessLauncher(String commandLine,
File baseDir) |
Modifier and Type | Method and Description |
---|---|
void |
abort()
Tries to abort the currently running process.
|
void |
addOutputListener(ProcessLauncher.OutputListener listener)
Add a listener for output from the to-be-launched process.
|
String |
getCommandLine()
Get the commandline that is used to launch the process.
|
String |
getErrorOutput()
Get error output, in case no listeners were registered - never returns
null.
|
String |
getStandardOutput()
Get standard output, in case no listeners were registered - never returns
null.
|
boolean |
hasFinished()
Check whether execution has finished.
|
int |
launch()
Launches the process, and blocks until that process completes execution.
|
public ProcessLauncher(String commandLine)
public ProcessLauncher(String[] commandArray)
public ProcessLauncher(ArrayList<?> commandList)
public void addOutputListener(ProcessLauncher.OutputListener listener)
public String getStandardOutput()
public String getErrorOutput()
public String getCommandLine()
public boolean hasFinished()
public int launch() throws ProcessLauncher.CommandNotExistsException
ProcessLauncher.CommandNotExistsException
- If the command could not be executed because it does not existpublic void abort()
Copyright © 2001-2016 Aduna. All Rights Reserved.