类 CommandLine
java.lang.Object
com.sh.common.exec.CommandLine
Description:
Title:首亨软件 - CRM、TSS、ERP等信息化管理软件
-
构造器概要
构造器构造器说明CommandLine(CommandLine other) Copy constructor.CommandLine(File executable) Create a command line without any arguments.CommandLine(String executable) Create a command line without any arguments. -
方法概要
修饰符和类型方法说明addArgument(String argument) Add a single argument.addArgument(String argument, boolean handleQuoting) Add a single argument.addArguments(String arguments) Add multiple arguments.addArguments(String[] arguments) Add multiple arguments.addArguments(String[] arguments, boolean handleQuoting) Add multiple arguments.addArguments(String arguments, boolean handleQuoting) Add multiple arguments.String[]Returns the expanded and quoted command line arguments.Returns the executable.booleanisFile()Was a file being used to set the executable?static CommandLineCreate a command line from a string.static CommandLineCreate a command line from a string.voidsetSubstitutionMap(Map substitutionMap) Set the substitutionMap to expand variables in the command line.toString()Stringify operator returns the command line as a string.String[]Returns the command line as an array of strings.
-
构造器详细资料
-
CommandLine
Create a command line without any arguments.- 参数:
executable- the executable
-
CommandLine
Create a command line without any arguments.- 参数:
executable- the executable file
-
CommandLine
Copy constructor.- 参数:
other- the instance to copy
-
-
方法详细资料
-
parse
Create a command line from a string.- 参数:
line- the first element becomes the executable, the rest the arguments- 返回:
- the parsed command line
- 抛出:
IllegalArgumentException- If line is null or all whitespace
-
parse
Create a command line from a string.- 参数:
line- the first element becomes the executable, the rest the argumentssubstitutionMap- the name/value pairs used for substitution- 返回:
- the parsed command line
- 抛出:
IllegalArgumentException- If line is null or all whitespace
-
getExecutable
Returns the executable.- 返回:
- The executable
-
isFile
public boolean isFile()Was a file being used to set the executable?- 返回:
- true if a file was used for setting the executable
-
addArguments
Add multiple arguments. Handles parsing of quotes and whitespace.- 参数:
arguments- An array of arguments- 返回:
- The command line itself
-
addArguments
Add multiple arguments.- 参数:
arguments- An array of argumentshandleQuoting- Add the argument with/without handling quoting- 返回:
- The command line itself
-
addArguments
Add multiple arguments. Handles parsing of quotes and whitespace. Please note that the parsing can have undesired side-effects therefore it is recommended to build the command line incrementally.- 参数:
arguments- An string containing multiple arguments.- 返回:
- The command line itself
-
addArguments
Add multiple arguments. Handles parsing of quotes and whitespace. Please note that the parsing can have undesired side-effects therefore it is recommended to build the command line incrementally.- 参数:
arguments- An string containing multiple arguments.handleQuoting- Add the argument with/without handling quoting- 返回:
- The command line itself
-
addArgument
Add a single argument. Handles quoting.- 参数:
argument- The argument to add- 返回:
- The command line itself
- 抛出:
IllegalArgumentException- If argument contains both single and double quotes
-
addArgument
Add a single argument.- 参数:
argument- The argument to addhandleQuoting- Add the argument with/without handling quoting- 返回:
- The command line itself
-
getArguments
Returns the expanded and quoted command line arguments.- 返回:
- The quoted arguments
-
getSubstitutionMap
- 返回:
- the substitution map
-
setSubstitutionMap
Set the substitutionMap to expand variables in the command line.- 参数:
substitutionMap- the map
-
toStrings
Returns the command line as an array of strings.- 返回:
- The command line as an string array
-
toString
Stringify operator returns the command line as a string. Parameters are correctly quoted when containing a space or left untouched if the are already quoted.
-