|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.commons.exec.CommandLine
public class CommandLine
CommandLine objects help handling command lines specifying processes to execute. The class can be used to a command line by an application.
| Constructor Summary | |
|---|---|
CommandLine(File executable)
Create a command line without any arguments. |
|
CommandLine(String executable)
Create a command line without any arguments. |
|
| Method Summary | |
|---|---|
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 quoted arguments. |
String |
getExecutable()
Returns the executable. |
Map |
getSubstitutionMap()
|
boolean |
isFile()
|
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. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public CommandLine(String executable)
executable - the executablepublic CommandLine(File executable)
executable - the executable file| Method Detail |
|---|
public static CommandLine parse(String line)
line - the first element becomes the executable, the rest the arguments
IllegalArgumentException - If line is null or all whitespace
public static CommandLine parse(String line,
Map substitutionMap)
line - the first element becomes the executable, the rest the argumentssubstitutionMap - the name/value pairs used for substitution
IllegalArgumentException - If line is null or all whitespacepublic String getExecutable()
public boolean isFile()
public CommandLine addArguments(String[] arguments)
arguments - An array of arguments
public CommandLine addArguments(String[] arguments,
boolean handleQuoting)
arguments - An array of argumentshandleQuoting - Add the argument with/without handling quoting
public 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 quoting
public CommandLine addArgument(String argument)
argument - The argument to add
IllegalArgumentException - If argument contains both single and double quotes
public CommandLine addArgument(String argument,
boolean handleQuoting)
argument - The argument to addhandleQuoting - Add the argument with/without handling quoting
public String[] getArguments()
public Map getSubstitutionMap()
public void setSubstitutionMap(Map substitutionMap)
substitutionMap - the mappublic String[] toStrings()
public String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||