public class CommandLine
extends java.lang.Object
构造器和说明 |
---|
CommandLine(CommandLine other)
Copy constructor.
|
CommandLine(java.io.File executable)
Create a command line without any arguments.
|
CommandLine(java.lang.String executable)
Create a command line without any arguments.
|
限定符和类型 | 方法和说明 |
---|---|
CommandLine |
addArgument(java.lang.String argument)
Add a single argument.
|
CommandLine |
addArgument(java.lang.String argument,
boolean handleQuoting)
Add a single argument.
|
CommandLine |
addArguments(java.lang.String arguments)
Add multiple arguments.
|
CommandLine |
addArguments(java.lang.String[] arguments)
Add multiple arguments.
|
CommandLine |
addArguments(java.lang.String[] arguments,
boolean handleQuoting)
Add multiple arguments.
|
CommandLine |
addArguments(java.lang.String arguments,
boolean handleQuoting)
Add multiple arguments.
|
java.lang.String[] |
getArguments()
Returns the expanded and quoted command line arguments.
|
java.lang.String |
getExecutable()
Returns the executable.
|
java.util.Map |
getSubstitutionMap() |
boolean |
isFile()
Was a file being used to set the executable?
|
static CommandLine |
parse(java.lang.String line)
Create a command line from a string.
|
static CommandLine |
parse(java.lang.String line,
java.util.Map substitutionMap)
Create a command line from a string.
|
void |
setSubstitutionMap(java.util.Map substitutionMap)
Set the substitutionMap to expand variables in the
command line.
|
java.lang.String |
toString()
Stringify operator returns the command line as a string.
|
java.lang.String[] |
toStrings()
Returns the command line as an array of strings.
|
public CommandLine(java.lang.String executable)
executable
- the executablepublic CommandLine(java.io.File executable)
executable
- the executable filepublic CommandLine(CommandLine other)
other
- the instance to copypublic static CommandLine parse(java.lang.String line)
line
- the first element becomes the executable, the rest the argumentsjava.lang.IllegalArgumentException
- If line is null or all whitespacepublic static CommandLine parse(java.lang.String line, java.util.Map substitutionMap)
line
- the first element becomes the executable, the rest the argumentssubstitutionMap
- the name/value pairs used for substitutionjava.lang.IllegalArgumentException
- If line is null or all whitespacepublic java.lang.String getExecutable()
public boolean isFile()
public CommandLine addArguments(java.lang.String[] arguments)
arguments
- An array of argumentspublic CommandLine addArguments(java.lang.String[] arguments, boolean handleQuoting)
arguments
- An array of argumentshandleQuoting
- Add the argument with/without handling quotingpublic CommandLine addArguments(java.lang.String arguments)
arguments
- An string containing multiple arguments.public CommandLine addArguments(java.lang.String arguments, boolean handleQuoting)
arguments
- An string containing multiple arguments.handleQuoting
- Add the argument with/without handling quotingpublic CommandLine addArgument(java.lang.String argument)
argument
- The argument to addjava.lang.IllegalArgumentException
- If argument contains both single and double quotespublic CommandLine addArgument(java.lang.String argument, boolean handleQuoting)
argument
- The argument to addhandleQuoting
- Add the argument with/without handling quotingpublic java.lang.String[] getArguments()
public java.util.Map getSubstitutionMap()
public void setSubstitutionMap(java.util.Map substitutionMap)
substitutionMap
- the mappublic java.lang.String[] toStrings()
public java.lang.String toString()
toString
在类中 java.lang.Object