public class Command
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
Command |
addArgument(java.lang.String arg) |
Command |
addArguments(java.util.List<java.lang.String> args) |
Command |
addArguments(java.lang.String[] args) |
Command |
addMaskedArgument(java.lang.String arg) |
static Command |
create(java.lang.String executable)
Create a command line without any arguments
|
java.util.List<java.lang.String> |
getArguments() |
java.io.File |
getDirectory() |
java.util.Map<java.lang.String,java.lang.String> |
getEnvironmentVariables()
Environment variables that are propagated during command execution.
|
java.lang.String |
getExecutable() |
boolean |
isNewShell()
true if a new shell should be used to execute the command. |
Command |
setDirectory(java.io.File d)
Sets working directory.
|
Command |
setEnvironmentVariable(java.lang.String name,
java.lang.String value) |
Command |
setNewShell(boolean b)
Set to
true if a new shell should be used to execute the command. |
java.lang.String |
toCommandLine() |
java.lang.String |
toString() |
public static Command create(java.lang.String executable)
executable
- public java.lang.String getExecutable()
public java.util.List<java.lang.String> getArguments()
public Command addArgument(java.lang.String arg)
public Command addMaskedArgument(java.lang.String arg)
public Command addArguments(java.util.List<java.lang.String> args)
public Command addArguments(java.lang.String[] args)
public java.io.File getDirectory()
public Command setDirectory(java.io.File d)
public Command setEnvironmentVariable(java.lang.String name, java.lang.String value)
getEnvironmentVariables()
public java.util.Map<java.lang.String,java.lang.String> getEnvironmentVariables()
public boolean isNewShell()
true
if a new shell should be used to execute the command.
The default behavior is to not use a new shell.public Command setNewShell(boolean b)
true
if a new shell should be used to execute the command.
This is useful when the executed command is a script with no execution rights (+x on unix).
On windows, the command will be executed with cmd /C executable
.
On other platforms, the command will be executed with sh executable
.public java.lang.String toCommandLine()
public java.lang.String toString()
toString
in class java.lang.Object