public class CommandLine extends Object
| Constructor and Description |
|---|
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.
|
| Modifier and Type | Method and Description |
|---|---|
CommandLine |
addArgument(String argument)
Add a single argument.
|
CommandLine |
addArgument(String argument,
boolean handleQuoting)
Add a single argument.
|
CommandLine |
addArguments(String arguments)
Add multiple arguments.
|
CommandLine |
addArguments(String[] arguments)
Add multiple arguments.
|
CommandLine |
addArguments(String[] arguments,
boolean handleQuoting)
Add multiple arguments.
|
CommandLine |
addArguments(String arguments,
boolean handleQuoting)
Add multiple arguments.
|
String[] |
getArguments()
Returns the expanded and quoted command line arguments.
|
String |
getExecutable()
Returns the executable.
|
Map |
getSubstitutionMap() |
boolean |
isFile()
Was a file being used to set the executable?
|
static CommandLine |
parse(String line)
Create a command line from a string.
|
static CommandLine |
parse(String line,
Map substitutionMap)
Create a command line from a string.
|
void |
setSubstitutionMap(Map substitutionMap)
Set the substitutionMap to expand variables in the
command line.
|
String |
toString()
Stringify operator returns the command line as a string.
|
String[] |
toStrings()
Returns the command line as an array of strings.
|
public CommandLine(String executable)
executable - the executablepublic CommandLine(File executable)
executable - the executable filepublic CommandLine(CommandLine other)
other - the instance to copypublic static CommandLine parse(String line)
line - the first element becomes the executable, the rest the argumentsIllegalArgumentException - If line is null or all whitespacepublic static CommandLine parse(String line, Map substitutionMap)
line - the first element becomes the executable, the rest the argumentssubstitutionMap - the name/value pairs used for substitutionIllegalArgumentException - If line is null or all whitespacepublic String getExecutable()
public boolean isFile()
public CommandLine addArguments(String[] arguments)
arguments - An array of argumentspublic CommandLine addArguments(String[] arguments, boolean handleQuoting)
arguments - An array of argumentshandleQuoting - Add the argument with/without handling quotingpublic CommandLine addArguments(String arguments)
arguments - An string containing multiple arguments.public CommandLine addArguments(String arguments, boolean handleQuoting)
arguments - An string containing multiple arguments.handleQuoting - Add the argument with/without handling quotingpublic CommandLine addArgument(String argument)
argument - The argument to addIllegalArgumentException - If argument contains both single and double quotespublic CommandLine addArgument(String argument, boolean handleQuoting)
argument - The argument to addhandleQuoting - Add the argument with/without handling quotingpublic String[] getArguments()
public Map getSubstitutionMap()
public void setSubstitutionMap(Map substitutionMap)
substitutionMap - the mappublic String[] toStrings()
Copyright © 2015 The Apache Software Foundation. All Rights Reserved.