jxta.security.util
Class GetOpt
java.lang.Object
|
+--jxta.security.util.GetOpt
- public class GetOpt
- extends java.lang.Object
This class provides the functionality for parsing command line
arguments (similar to getopt(3C)).
After constructing an instance of it, getNextOption() can be used
to get the next option. getOptionArg() can be used to get the argument for
that option. getNextOptionIndex() returns how many arguments are already
processed from the arguments list.
Constructor Summary |
GetOpt(java.lang.String[] argv,
java.lang.String optionString)
Constructor |
Method Summary |
int |
getNextOption()
Returns the next valid option. |
int |
getNextOptionIndex()
Returns how many arguments are already processed by the getNextOption()
function. |
java.lang.String |
getOptionArg()
Returns the argument for the option being handled. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
GetOpt
public GetOpt(java.lang.String[] argv,
java.lang.String optionString)
- Constructor
getNextOption
public int getNextOption()
throws java.lang.IllegalArgumentException
- Returns the next valid option.
Throws an IllegalArgumentException
a) if option is not valid or
b) an option required an argument and is not provided
Returns -1 if no more options left.
getOptionArg
public java.lang.String getOptionArg()
- Returns the argument for the option being handled.
getNextOptionIndex
public int getNextOptionIndex()
- Returns how many arguments are already processed by the getNextOption()
function. The other way to look at it is what argument is going to be
processed by getNextOption() method next.