public class WbCommandLine extends Object implements Cloneable
<someelement>
The element
<acommandline executable="/executable/to/run">
<argument value="argument 1" />
<argument line="argument_1 argument_2 argument_3" />
<argument value="argument 4" />
</acommandline>
</someelement>
someelement
must provide a method
createAcommandline
which returns an instance of this class.
Modifier and Type | Class and Description |
---|---|
static class |
WbCommandLine.Argument
Used for nested xml command line definitions.
|
class |
WbCommandLine.Marker
Class to keep track of the position of an Argument.
|
Modifier and Type | Field and Description |
---|---|
protected static String |
DISCLAIMER |
Constructor and Description |
---|
WbCommandLine() |
WbCommandLine(String to_process) |
Modifier and Type | Method and Description |
---|---|
void |
addArguments(String[] line) |
void |
clear()
Clear out the whole command line.
|
void |
clearArgs()
Clear out the arguments but leave the executable in place for
another operation.
|
Object |
clone() |
WbCommandLine.Argument |
createArgument()
Creates an argument object.
|
WbCommandLine.Argument |
createArgument(boolean insertAtStart)
Creates an argument object and adds it to our list of args.
|
WbCommandLine.Marker |
createMarker()
Return a marker.
|
String |
describeArguments()
Returns a String that describes the arguments suitable for
verbose output before a call to
Runtime.exec(String[]) |
static String |
describeArguments(String[] args)
Returns a String that describes the arguments suitable for
verbose output before a call to
Runtime.exec(String[]) |
protected static String |
describeArguments(String[] args,
int offset)
Returns a String that describes the arguments suitable for
verbose output before a call to
Runtime.exec(String[]) |
static String |
describeArguments(WbCommandLine line)
Returns a String that describes the arguments suitable for
verbose output before a call to
Runtime.exec(String[]) |
String |
describeCommand()
Returns a String that describes the command and arguments
suitable for verbose output before a call to
Runtime.exec(String[]) |
static String |
describeCommand(String[] args)
Returns a String that describes the command and arguments
suitable for verbose output before a call to
Runtime.exec(String[]) . |
static String |
describeCommand(WbCommandLine line)
Returns a String that describes the command and arguments
suitable for verbose output before a call to
Runtime.exec(String[]) |
String[] |
getArguments()
Returns all arguments defined by
addLine ,
addValue or the argument object. |
String[] |
getCommandline()
Returns the executable and all defined arguments.
|
String |
getExecutable() |
static String |
quoteArgument(String argument)
Put quotes around the given String if necessary.
|
void |
setExecutable(String executable)
Sets the executable to run.
|
int |
size() |
String |
toString() |
static String |
toString(String[] line)
Quotes the parts of the given array in way that makes them
usable as command line arguments.
|
static String[] |
translateCommandline(String to_process) |
protected static final String DISCLAIMER
public WbCommandLine(String to_process)
public WbCommandLine()
public WbCommandLine.Argument createArgument()
Each commandline object has at most one instance of the
argument class. This method calls
this.createArgument(false)
.
createArgument(boolean)
public WbCommandLine.Argument createArgument(boolean insertAtStart)
Each commandline object has at most one instance of the argument class.
insertAtStart
- if true, the argument is inserted at the
beginning of the list of args, otherwise it is appended.public void setExecutable(String executable)
public String getExecutable()
public void addArguments(String[] line)
public String[] getCommandline()
public String[] getArguments()
addLine
,
addValue
or the argument object.public static String quoteArgument(String argument)
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.
IllegalArgumentException
- if the argument contains both, single
and double quotes.public static String toString(String[] line)
public int size()
public void clear()
public void clearArgs()
public WbCommandLine.Marker createMarker()
This marker can be used to locate a position on the commandline - to insert something for example - when all parameters have been set.
public String describeCommand()
Runtime.exec(String[])
public String describeArguments()
Runtime.exec(String[])
public static String describeCommand(WbCommandLine line)
Runtime.exec(String[])
public static String describeArguments(WbCommandLine line)
Runtime.exec(String[])
public static String describeCommand(String[] args)
Runtime.exec(String[])
.
This method assumes that the first entry in the array is the executable to run.
public static String describeArguments(String[] args)
Runtime.exec(String[])
Copyright © 2018. All rights reserved.