public static class Shell.ShellCommandExecutor extends Shell
ShellCommandExecutorshould be used in cases where the output
of the command needs no explicit parsing and where the command, working
directory and the environment remains unchanged. The output of the command
is stored as-is and is expected to be small.Shell.ExitCodeException, Shell.ShellCommandExecutor| Constructor and Description |
|---|
ShellCommandExecutor(java.lang.String[] execString,
long timeout)
Create a new instance of the ShellCommandExecutor to execute a command.
|
| Modifier and Type | Method and Description |
|---|---|
protected java.lang.String[] |
execString()
Return an array containing the command name and its parameters
|
void |
execute()
Execute the shell command.
|
java.lang.String |
output()
Get the output of the shell command.
|
protected void |
parseExecResult(java.io.BufferedReader reader)
Parse the execution result
|
java.lang.String |
toString()
Returns the commands of this instance.
|
execCommand, execCommand, exitCode, process, runpublic ShellCommandExecutor(java.lang.String[] execString,
long timeout)
execString - The command to execute with argumentstimeout - Specifies the time in milliseconds, after which the
command will be killed. -1 means no timeout.public void execute()
throws java.io.IOException
java.io.IOExceptionprotected java.lang.String[] execString()
ShellexecString in class Shellprotected void parseExecResult(java.io.BufferedReader reader)
throws java.io.IOException
ShellparseExecResult in class Shelljava.io.IOExceptionpublic java.lang.String output()
public java.lang.String toString()
toString in class java.lang.Object