|
||||||||||
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(java.io.File executable)
Create a command line without any arguments. |
|
CommandLine(java.lang.String executable)
Create a command line without any arguments. |
Method Summary | |
---|---|
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 quoted arguments. |
java.lang.String |
getExecutable()
Returns the executable. |
java.util.Map |
getSubstitutionMap()
|
boolean |
isFile()
|
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public CommandLine(java.lang.String executable)
executable
- the executablepublic CommandLine(java.io.File executable)
executable
- the executable fileMethod Detail |
---|
public static CommandLine parse(java.lang.String line)
line
- the first element becomes the executable, the rest the arguments
java.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 substitution
java.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 arguments
public CommandLine addArguments(java.lang.String[] arguments, boolean handleQuoting)
arguments
- An array of argumentshandleQuoting
- Add the argument with/without handling quoting
public 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 quoting
public CommandLine addArgument(java.lang.String argument)
argument
- The argument to add
java.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 quoting
public 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
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |