The class can be used to define a command line as nested elements or as a helper to define a command line by an application.
<someelement> <acommandline executable="/executable/to/run"> <argument value="argument 1"/> <argument line="argument_1 argument_2 argument_3"/> <argument value="argument 4"/> </acommandline> </someelement>The element
someelement
must provide a method
createAcommandline
which returns an instance of this class.
Modifier and Type | Class and Description |
---|---|
public static class | Commandline.Argument
Used for nested xml command line definitions. |
public class | Commandline.Marker
Class to keep track of the position of an Argument. |
Modifier and Type | Field and Description |
---|---|
private List | arguments
The arguments of the command |
protected static final String | |
private String | executable
the program to execute |
private static final boolean | IS_WIN_9X
win9x uses a (shudder) bat file (antRun.bat) for executing commands |
Access | Constructor and Description |
---|---|
public | Commandline(String
the line: the first element becomes the executable, the rest
the arguments. toProcess)Create a command line from a string. |
public |
Modifier and Type | Method and Description |
---|---|
public void | addArguments(String[]
an array of arguments to append. line)Append the arguments to the existing command. |
public void | addArgumentsToList(ListIterator<String>
the list of arguments. list)Append all the arguments to the tail of a supplied list. |
public void | addCommandToList(ListIterator<String>
the list to add to. list)Add the entire command, including (optional) executable to a list. |
public void | |
public void | |
public Object | Returns: a clone of the contained objectOverrides java. |
public Commandline. | |
public Commandline. | Returns: an argument to be configuredif true, the argument is inserted at the
beginning of the list of args, otherwise it is appended. insertAtStart)Create an argument object and add it to our list of args. |
public Commandline. | |
public String | Returns: a string that describes the arguments.Return a String that describes the arguments suitable for
verbose output before a call to |
public static String | Returns: a string that describes the arguments.the Commandline whose arguments to describe. line)Return a String that describes the arguments suitable for
verbose output before a call to |
public static String | Returns: a string that describes the arguments.the command line to describe as an array of strings. args)Return a String that describes the arguments suitable for
verbose output before a call to |
protected static String | Returns: a string that describes the argumentsthe command line to describe as an array of strings. args, int ignore entries before this index. offset)Return a String that describes the arguments suitable for
verbose output before a call to |
public String | Returns: a string that describes the command and arguments.Return a String that describes the command and arguments suitable for
verbose output before a call to |
public static String | Returns: a string that describes the command and arguments.the Commandline to describe. line)Return a String that describes the command and arguments suitable for
verbose output before a call to |
public static String | Returns: a string that describes the command and arguments.the command line to describe as an array of strings args)Return a String that describes the command and arguments suitable for
verbose output before a call to |
public String[] | Returns: the arguments as an array of strings.Returns all arguments defined by |
public String[] | Returns: the commandline as an array of strings.Return the executable and all defined arguments. |
public String | |
public Iterator | |
public static String | Returns: the quoted argument.the argument to quote if necessary. argument)Put quotes around the given String if necessary. |
public void | |
public void | setExecutable(String
the String executable name. executable, boolean if translateFileSeparator)true all file separators in the string
are converted to the platform specific value.Set the executable to run. |
public int | |
public String | Returns: the command line.Overrides java. |
public static String | |
public static String[] | Returns: the command line broken into strings. An empty or null toProcess parameter results in a zero sized array.the command line to process. toProcess)Crack a command line. |
arguments | back to summary |
---|---|
private List<Commandline. The arguments of the command |
DISCLAIMER | back to summary |
---|---|
protected static final String DISCLAIMER |
executable | back to summary |
---|---|
private String executable the program to execute |
IS_WIN_9X | back to summary |
---|---|
private static final boolean IS_WIN_9X win9x uses a (shudder) bat file (antRun.bat) for executing commands |
Commandline | back to summary |
---|---|
public Commandline(String toProcess) Create a command line from a string.
|
Commandline | back to summary |
---|---|
public Commandline() Create an empty command line. |
addArguments | back to summary |
---|---|
public void addArguments(String[] line) Append the arguments to the existing command.
|
addArgumentsToList | back to summary |
---|---|
public void addArgumentsToList(ListIterator<String> list) Append all the arguments to the tail of a supplied list.
|
addCommandToList | back to summary |
---|---|
public void addCommandToList(ListIterator<String> list) Add the entire command, including (optional) executable to a list.
|
clear | back to summary |
---|---|
public void clear() Clear out the whole command line. |
clearArgs | back to summary |
---|---|
public void clearArgs() Clear out the arguments but leave the executable in place for another operation. |
clone | back to summary |
---|---|
public Object clone() Overrides java. Generate a deep clone of the contained object. |
createArgument | back to summary |
---|---|
public Commandline. Create an argument object. Each commandline object has at most one instance of the
argument class. This method calls
|
createArgument | back to summary |
---|---|
public Commandline. Create an argument object and add it to our list of args. Each commandline object has at most one instance of the argument class.
|
createMarker | back to summary |
---|---|
public Commandline. Return a marker. This marker can be used to locate a position on the commandline--to insert something for example--when all parameters have been set.
|
describeArguments | back to summary |
---|---|
public String describeArguments() Return a String that describes the arguments suitable for
verbose output before a call to
|
describeArguments | back to summary |
---|---|
public static String describeArguments(Commandline line) Return a String that describes the arguments suitable for
verbose output before a call to
|
describeArguments | back to summary |
---|---|
public static String describeArguments(String[] args) Return a String that describes the arguments suitable for
verbose output before a call to |
describeArguments | back to summary |
---|---|
protected static String describeArguments(String[] args, int offset) Return a String that describes the arguments suitable for
verbose output before a call to |
describeCommand | back to summary |
---|---|
public String describeCommand() Return a String that describes the command and arguments suitable for
verbose output before a call to
|
describeCommand | back to summary |
---|---|
public static String describeCommand(Commandline line) Return a String that describes the command and arguments suitable for
verbose output before a call to
|
describeCommand | back to summary |
---|---|
public static String describeCommand(String[] args) Return a String that describes the command and arguments suitable for
verbose output before a call to This method assumes that the first entry in the array is the executable to run. |
getArguments | back to summary |
---|---|
public String[] getArguments() Returns all arguments defined by
|
getCommandline | back to summary |
---|---|
public String[] getCommandline() Return the executable and all defined arguments.
|
getExecutable | back to summary |
---|---|
public String getExecutable() Get the executable.
|
iterator | back to summary |
---|---|
public Iterator Get an iterator to the arguments list.
|
quoteArgument | back to summary |
---|---|
public static String quoteArgument(String argument) Put quotes around the given String if necessary. If the argument doesn't include spaces or quotes, return it as is. If it contains double quotes, use single quotes - else surround the argument by double quotes.
|
setExecutable | back to summary |
---|---|
public void setExecutable(String executable) Set the executable to run. All file separators in the string are converted to the platform specific value.
|
setExecutable | back to summary |
---|---|
public void setExecutable(String executable, boolean translateFileSeparator) Set the executable to run.
|
size | back to summary |
---|---|
public int size() Size operator. This actually creates the command line, so it is not a zero cost operation.
|
toString | back to summary |
---|---|
public String toString() Overrides java. Return the command line as a string. |
toString | back to summary |
---|---|
public static String toString(String[] line) Quote the parts of the given array in way that makes them usable as command line arguments. |
translateCommandline | back to summary |
---|---|
public static String[] translateCommandline(String toProcess) Crack a command line. |
Modifier and Type | Field and Description |
---|---|
private String[] | |
private String | |
private String |
Access | Constructor and Description |
---|---|
public |
Modifier and Type | Method and Description |
---|---|
public void | copyFrom(Commandline.
the argument to copy setting from otherCopies settings from a different argument. |
public String[] | |
public void | |
public void | |
public void | |
public void | setPathref(Reference
a single commandline argument. value)Set a single commandline argument from a reference to a path--ensuring the right separator for the local platform is used. |
public void | |
public void | |
public void |
parts | back to summary |
---|---|
private String[] parts |
prefix | back to summary |
---|---|
private String prefix |
suffix | back to summary |
---|---|
private String suffix |
Argument | back to summary |
---|---|
public Argument() |
copyFrom | back to summary |
---|---|
public void copyFrom(Commandline. Copies settings from a different argument.
|
getParts | back to summary |
---|---|
public String[] getParts() Return the constituent parts of this Argument.
|
setFile | back to summary |
---|---|
public void setFile(File value) Set a single commandline argument to the absolute filename of the given file.
|
setLine | back to summary |
---|---|
public void setLine(String line) Set the line to split into several commandline arguments.
|
setPath | back to summary |
---|---|
public void setPath(Path value) Set a single commandline argument and treats it like a PATH--ensuring the right separator for the local platform is used.
|
setPathref | back to summary |
---|---|
public void setPathref(Reference value) Set a single commandline argument from a reference to a path--ensuring the right separator for the local platform is used.
|
setPrefix | back to summary |
---|---|
public void setPrefix(String prefix) Set the prefix to be placed in front of every part of the argument.
|
setSuffix | back to summary |
---|---|
public void setSuffix(String suffix) Set the suffix to be placed at the end of every part of the argument.
|
setValue | back to summary |
---|---|
public void setValue(String value) Set a single commandline argument.
|
This class is there to support the srcfile and targetfile elements of <apply>.
Modifier and Type | Field and Description |
---|---|
private int | |
private String | |
private int | |
private String |
Access | Constructor and Description |
---|---|
pack-priv |
Modifier and Type | Method and Description |
---|---|
public int | Returns: the position of this marker.Return the number of arguments that preceded this marker. |
public String | |
public String | |
public void | |
public void |
position | back to summary |
---|---|
private int position |
prefix | back to summary |
---|---|
private String prefix |
realPos | back to summary |
---|---|
private int realPos |
suffix | back to summary |
---|---|
private String suffix |
Marker | back to summary |
---|---|
pack-priv Marker(int position) Construct a marker for the specified position.
|
getPosition | back to summary |
---|---|
public int getPosition() Return the number of arguments that preceded this marker. The name of the executable -- if set -- is counted as the first argument.
|
getPrefix | back to summary |
---|---|
public String getPrefix() Get the prefix to be placed in front of the inserted argument.
|
getSuffix | back to summary |
---|---|
public String getSuffix() Get the suffix to be placed at the end of the inserted argument.
|
setPrefix | back to summary |
---|---|
public void setPrefix(String prefix) Set the prefix to be placed in front of the inserted argument.
|
setSuffix | back to summary |
---|---|
public void setSuffix(String suffix) Set the suffix to be placed at the end of the inserted argument.
|