public class CommandLine
extends java.lang.Object
ProcessBuilder
. Has the following:
Modifier and Type | Field and Description |
---|---|
protected boolean |
cleanEnvironment |
protected java.util.List<java.lang.String> |
cmdLine |
protected java.util.Map<java.lang.String,java.lang.String> |
env |
protected java.io.OutputStream |
err |
protected java.lang.String |
errPrefix |
static int |
OK |
protected java.io.OutputStream |
out |
protected java.lang.String |
outPrefix |
protected java.io.File |
workingDirectory |
Modifier | Constructor and Description |
---|---|
protected |
CommandLine(java.lang.String command) |
Modifier and Type | Method and Description |
---|---|
CommandLine |
arg(java.lang.String argument)
Adds single argument.
|
CommandLine |
args(java.lang.String... arguments)
Adds several arguments.
|
static CommandLine |
cmd(java.lang.String command)
Creates command line with given command.
|
CommandLine |
env(java.lang.String key,
java.lang.String value)
Sets environment variable.
|
CommandLine |
err(java.io.OutputStream err) |
CommandLine |
errPrefix(java.lang.String prefix)
Defines error prefix.
|
CommandLine |
newEnv(boolean clean)
When set to
true , environment will not be copied from the
parent process and will be completly empty. |
CommandLine |
out(java.io.OutputStream out) |
CommandLine |
outPrefix(java.lang.String prefix)
Defines output prefix.
|
ProcessRunner.ProcessResult |
run()
Runs command and returns process result.
|
CommandLine |
workingDirectory(java.io.File workDirectory)
Defines working directory.
|
CommandLine |
workingDirectory(java.lang.String workDirectory)
Defines working directory.
|
public static final int OK
protected final java.util.List<java.lang.String> cmdLine
protected java.util.Map<java.lang.String,java.lang.String> env
protected boolean cleanEnvironment
protected java.io.File workingDirectory
protected java.lang.String outPrefix
protected java.lang.String errPrefix
protected java.io.OutputStream out
protected java.io.OutputStream err
public static CommandLine cmd(java.lang.String command)
public CommandLine workingDirectory(java.io.File workDirectory)
public CommandLine workingDirectory(java.lang.String workDirectory)
public CommandLine arg(java.lang.String argument)
public CommandLine args(java.lang.String... arguments)
public CommandLine outPrefix(java.lang.String prefix)
public CommandLine errPrefix(java.lang.String prefix)
public CommandLine out(java.io.OutputStream out)
public CommandLine err(java.io.OutputStream err)
public CommandLine env(java.lang.String key, java.lang.String value)
public CommandLine newEnv(boolean clean)
true
, environment will not be copied from the
parent process and will be completly empty.public ProcessRunner.ProcessResult run()
Copyright © 2003-present Jodd Team