|
Server : Apache/2.2.2 (Fedora) System : Linux App1.pathumtani.go.th 2.6.20-1.2320.fc5smp #1 SMP Tue Jun 12 19:40:16 EDT 2007 i686 User : apache ( 48) PHP Version : 5.2.9 Disable Function : NONE Directory : /usr/share/javadoc/gnu.getopt-1.0.9/gnu/getopt/ |
Upload File : |
<?xml version="1.0" encoding="US-ASCII"?>
<!DOCTYPE html PUBLIC "-//gnu.org///DTD XHTML 1.1 plus Target 1.0//EN" "../../resources/xhtml11-target10.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><title>Getopt (gnu.getopt JavaDoc)</title><script src="../../resources/gjdoc.js" type="text/javascript"><!-- this comment required for konqueror 3.2.2 --></script><meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"/><meta name="generator" content="GNU Gjdoc Standard Doclet"/><meta name="keywords" content="gnu.getopt.Getopt class"/><meta name="keywords" content="REQUIRE_ORDER"/><meta name="keywords" content="PERMUTE"/><meta name="keywords" content="RETURN_IN_ORDER"/><meta name="keywords" content="optarg"/><meta name="keywords" content="optind"/><meta name="keywords" content="opterr"/><meta name="keywords" content="optopt"/><meta name="keywords" content="nextchar"/><meta name="keywords" content="optstring"/><meta name="keywords" content="long_options"/><meta name="keywords" content="long_only"/><meta name="keywords" content="longind"/><meta name="keywords" content="posixly_correct"/><meta name="keywords" content="longopt_handled"/><meta name="keywords" content="first_nonopt"/><meta name="keywords" content="last_nonopt"/><meta name="keywords" content="argv"/><meta name="keywords" content="ordering"/><meta name="keywords" content="progname"/><meta name="keywords" content="setOptstring()"/><meta name="keywords" content="getOptind()"/><meta name="keywords" content="setOptind()"/><meta name="keywords" content="setArgv()"/><meta name="keywords" content="getOptarg()"/><meta name="keywords" content="setOpterr()"/><meta name="keywords" content="getOptopt()"/><meta name="keywords" content="getLongind()"/><meta name="keywords" content="exchange()"/><meta name="keywords" content="checkLongOption()"/><meta name="keywords" content="getopt()"/><link rel="stylesheet" type="text/css" href="../../resources/gjdochtml-clean-layout.css" title="GNU Clean"/><link rel="stylesheet" type="text/css" href="../../resources/gjdochtml-clean-color1.css" title="GNU Clean"/></head><body class="content class" onload="if(parent.contentPageLoaded)parent.contentPageLoaded(document.title)"><table class="navbar div top"><tr><td class="navbar div top"><div class="navbar div top"><span class="navbar item enabled"><a href="../../overview-summary.html">Overview</a></span> <span class="navbar item enabled"><a href="package-summary.html">Package</a></span> <span class="navbar item enabled"><a href="tree.html">Tree</a></span> <span class="navbar item enabled"><a href="../../alphaindex.html">Index</a></span> <span class="navbar item enabled"><a href="../../deprecated.html">Deprecated</a></span> <span class="navbar item enabled"><a href="../../about.html">About</a></span></div></td></tr><tr><td class="navi">Prev Class | <a href="../../gnu/getopt/GetoptDemo.html">Next Class</a></td><td class="navi"><a href="../../index.html" title="Show in a frameset" target="_top">Frames</a> | <a href="Getopt.html" title="Show without frames" target="_top">No Frames</a> </td></tr><tr><td class="navi">Summary: Nested | <a href="#summary-fields">Field</a> | <a href="#summary-methods">Method</a> | <a href="#summary-constructors">Constr</a></td><td class="navi">Detail: Nested | <a href="#detail-fields">Field</a> | <a href="#detail-methods">Method</a> | <a href="#detail-constructors">Constr</a></td></tr></table><div class="class title outer"><h3 class="class title-package">gnu.getopt</h3><h1 class="class title-class">Class Getopt</h1></div><div class="class inheritance-tree"><ul class="inheritance 0"><li class="inheritance 0"><code>Object</code></li><li><ul class="inheritance 1"><li class="inheritance 1"><code>gnu.getopt.Getopt</code></li><li></li></ul></li></ul></div><hr/><div class="class synopsis outer"><div class="class synopsis declaration"><code>public class <b class="class synopsis name">Getopt</b></code></div><div class="class synopsis superclass"><code>extends Object</code></div></div><hr/><div class="class description"> This is a Java port of GNU getopt, a class for parsing command line
arguments passed to programs. It it based on the C getopt() functions
in glibc 2.0.6 and should parse options in a 100% compatible manner.
If it does not, that is a bug. The programmer's interface is also
very compatible.
<p/>
To use Getopt, create a Getopt object with a argv array passed to the
main method, then call the getopt() method in a loop. It will return an
int that contains the value of the option character parsed from the
command line. When there are no more options to be parsed, it
returns -1.
<p/>
A command line option can be defined to take an argument. If an
option has an argument, the value of that argument is stored in an
instance variable called optarg, which can be accessed using the
getOptarg() method. If an option that requires an argument is
found, but there is no argument present, then an error message is
printed. Normally getopt() returns a '?' in this situation, but
that can be changed as described below.
<p/>
If an invalid option is encountered, an error message is printed
to the standard error and getopt() returns a '?'. The value of the
invalid option encountered is stored in the instance variable optopt
which can be retrieved using the getOptopt() method. To suppress
the printing of error messages for this or any other error, set
the value of the opterr instance variable to false using the
setOpterr() method.
<p/>
Between calls to getopt(), the instance variable optind is used to
keep track of where the object is in the parsing process. After all
options have been returned, optind is the index in argv of the first
non-option argument. This variable can be accessed with the getOptind()
method.
<p/>
Note that this object expects command line options to be passed in the
traditional Unix manner. That is, proceeded by a '-' character.
Multiple options can follow the '-'. For example "-abc" is equivalent
to "-a -b -c". If an option takes a required argument, the value
of the argument can immediately follow the option character or be
present in the next argv element. For example, "-cfoo" and "-c foo"
both represent an option character of 'c' with an argument of "foo"
assuming c takes a required argument. If an option takes an argument
that is not required, then any argument must immediately follow the
option character in the same argv element. For example, if c takes
a non-required argument, then "-cfoo" represents option character 'c'
with an argument of "foo" while "-c foo" represents the option
character 'c' with no argument, and a first non-option argv element
of "foo".
<p/>
The user can stop getopt() from scanning any further into a command line
by using the special argument "--" by itself. For example:
"-a -- -d" would return an option character of 'a', then return -1
The "--" is discarded and "-d" is pointed to by optind as the first
non-option argv element.
<p/>
Here is a basic example of using Getopt:
<p/>
<pre>
Getopt g = new Getopt("testprog", argv, "ab:c::d");
//
int c;
String arg;
while ((c = g.getopt()) != -1)
{
switch(c)
{
case 'a':
case 'd':
System.out.print("You picked " + (char)c + "\n");
break;
//
case 'b':
case 'c':
arg = g.getOptarg();
System.out.print("You picked " + (char)c +
" with an argument of " +
((arg != null) ? arg : "null") + "\n");
break;
//
case '?':
break; // getopt() already printed an error
//
default:
System.out.print("getopt() returned " + c + "\n");
}
}
</pre>
<p/>
In this example, a new Getopt object is created with three params.
The first param is the program name. This is for printing error
messages in the form "program: error message". In the C version, this
value is taken from argv[0], but in Java the program name is not passed
in that element, thus the need for this parameter. The second param is
the argument list that was passed to the main() method. The third
param is the list of valid options. Each character represents a valid
option. If the character is followed by a single colon, then that
option has a required argument. If the character is followed by two
colons, then that option has an argument that is not required.
<p/>
Note in this example that the value returned from getopt() is cast to
a char prior to printing. This is required in order to make the value
display correctly as a character instead of an integer.
<p/>
If the first character in the option string is a colon, for example
":abc::d", then getopt() will return a ':' instead of a '?' when it
encounters an option with a missing required argument. This allows the
caller to distinguish between invalid options and valid options that
are simply incomplete.
<p/>
In the traditional Unix getopt(), -1 is returned when the first non-option
charcter is encountered. In GNU getopt(), the default behavior is to
allow options to appear anywhere on the command line. The getopt()
method permutes the argument to make it appear to the caller that all
options were at the beginning of the command line, and all non-options
were at the end. For example, calling getopt() with command line args
of "-a foo bar -d" returns options 'a' and 'd', then sets optind to
point to "foo". The program would read the last two argv elements as
"foo" and "bar", just as if the user had typed "-a -d foo bar".
<p/>
The user can force getopt() to stop scanning the command line with
the special argument "--" by itself. Any elements occuring before the
"--" are scanned and permuted as normal. Any elements after the "--"
are returned as is as non-option argv elements. For example,
"foo -a -- bar -d" would return option 'a' then -1. optind would point
to "foo", "bar" and "-d" as the non-option argv elements. The "--"
is discarded by getopt().
<p/>
There are two ways this default behavior can be modified. The first is
to specify traditional Unix getopt() behavior (which is also POSIX
behavior) in which scanning stops when the first non-option argument
encountered. (Thus "-a foo bar -d" would return 'a' as an option and
have "foo", "bar", and "-d" as non-option elements). The second is to
allow options anywhere, but to return all elements in the order they
occur on the command line. When a non-option element is ecountered,
an integer 1 is returned and the value of the non-option element is
stored in optarg is if it were the argument to that option. For
example, "-a foo -d", returns first 'a', then 1 (with optarg set to
"foo") then 'd' then -1. When this "return in order" functionality
is enabled, the only way to stop getopt() from scanning all command
line elements is to use the special "--" string by itself as described
above. An example is "-a foo -b -- bar", which would return 'a', then
integer 1 with optarg set to "foo", then 'b', then -1. optind would
then point to "bar" as the first non-option argv element. The "--"
is discarded.
<p/>
The POSIX/traditional behavior is enabled by either setting the
property "gnu.posixly_correct" or by putting a '+' sign as the first
character of the option string. The difference between the two
methods is that setting the gnu.posixly_correct property also forces
certain error messages to be displayed in POSIX format. To enable
the "return in order" functionality, put a '-' as the first character
of the option string. Note that after determining the proper
behavior, Getopt strips this leading '+' or '-', meaning that a ':'
placed as the second character after one of those two will still cause
getopt() to return a ':' instead of a '?' if a required option
argument is missing.
<p/>
In addition to traditional single character options, GNU Getopt also
supports long options. These are preceeded by a "--" sequence and
can be as long as desired. Long options provide a more user-friendly
way of entering command line options. For example, in addition to a
"-h" for help, a program could support also "--help".
<p/>
Like short options, long options can also take a required or non-required
argument. Required arguments can either be specified by placing an
equals sign after the option name, then the argument, or by putting the
argument in the next argv element. For example: "--outputdir=foo" and
"--outputdir foo" both represent an option of "outputdir" with an
argument of "foo", assuming that outputdir takes a required argument.
If a long option takes a non-required argument, then the equals sign
form must be used to specify the argument. In this case,
"--outputdir=foo" would represent option outputdir with an argument of
"foo" while "--outputdir foo" would represent the option outputdir
with no argument and a first non-option argv element of "foo".
<p/>
Long options can also be specified using a special POSIX argument
format (one that I highly discourage). This form of entry is
enabled by placing a "W;" (yes, 'W' then a semi-colon) in the valid
option string. This causes getopt to treat the name following the
"-W" as the name of the long option. For example, "-W outputdir=foo"
would be equivalent to "--outputdir=foo". The name can immediately
follow the "-W" like so: "-Woutputdir=foo". Option arguments are
handled identically to normal long options. If a string follows the
"-W" that does not represent a valid long option, then getopt() returns
'W' and the caller must decide what to do. Otherwise getopt() returns
a long option value as described below.
<p/>
While long options offer convenience, they can also be tedious to type
in full. So it is permissible to abbreviate the option name to as
few characters as required to uniquely identify it. If the name can
represent multiple long options, then an error message is printed and
getopt() returns a '?'.
<p/>
If an invalid option is specified or a required option argument is
missing, getopt() prints an error and returns a '?' or ':' exactly
as for short options. Note that when an invalid long option is
encountered, the optopt variable is set to integer 0 and so cannot
be used to identify the incorrect option the user entered.
<p/>
Long options are defined by LongOpt objects. These objects are created
with a contructor that takes four params: a String representing the
object name, a integer specifying what arguments the option takes
(the value is one of LongOpt.NO_ARGUMENT, LongOpt.REQUIRED_ARGUMENT,
or LongOpt.OPTIONAL_ARGUMENT), a StringBuffer flag object (described
below), and an integer value (described below).
<p/>
To enable long option parsing, create an array of LongOpt's representing
the legal options and pass it to the Getopt() constructor. WARNING: If
all elements of the array are not populated with LongOpt objects, the
getopt() method will throw a NullPointerException.
<p/>
When getopt() is called and a long option is encountered, one of two
things can be returned. If the flag field in the LongOpt object
representing the long option is non-null, then the integer value field
is stored there and an integer 0 is returned to the caller. The val
field can then be retrieved from the flag field. Note that since the
flag field is a StringBuffer, the appropriate String to integer converions
must be performed in order to get the actual int value stored there.
If the flag field in the LongOpt object is null, then the value field
of the LongOpt is returned. This can be the character of a short option.
This allows an app to have both a long and short option sequence
(say, "-h" and "--help") that do the exact same thing.
<p/>
With long options, there is an alternative method of determining
which option was selected. The method getLongind() will return the
the index in the long option array (NOT argv) of the long option found.
So if multiple long options are configured to return the same value,
the application can use getLongind() to distinguish between them.
<p/>
Here is an expanded Getopt example using long options and various
techniques described above:
<p/>
<pre>
int c;
String arg;
LongOpt[] longopts = new LongOpt[3];
//
StringBuffer sb = new StringBuffer();
longopts[0] = new LongOpt("help", LongOpt.NO_ARGUMENT, null, 'h');
longopts[1] = new LongOpt("outputdir", LongOpt.REQUIRED_ARGUMENT, sb, 'o');
longopts[2] = new LongOpt("maximum", LongOpt.OPTIONAL_ARGUMENT, null, 2);
//
Getopt g = new Getopt("testprog", argv, "-:bc::d:hW;", longopts);
g.setOpterr(false); // We'll do our own error handling
//
while ((c = g.getopt()) != -1)
switch (c)
{
case 0:
arg = g.getOptarg();
System.out.println("Got long option with value '" +
(char)(new Integer(sb.toString())).intValue()
+ "' with argument " +
((arg != null) ? arg : "null"));
break;
//
case 1:
System.out.println("I see you have return in order set and that " +
"a non-option argv element was just found " +
"with the value '" + g.getOptarg() + "'");
break;
//
case 2:
arg = g.getOptarg();
System.out.println("I know this, but pretend I didn't");
System.out.println("We picked option " +
longopts[g.getLongind()].getName() +
" with value " +
((arg != null) ? arg : "null"));
break;
//
case 'b':
System.out.println("You picked plain old option " + (char)c);
break;
//
case 'c':
case 'd':
arg = g.getOptarg();
System.out.println("You picked option '" + (char)c +
"' with argument " +
((arg != null) ? arg : "null"));
break;
//
case 'h':
System.out.println("I see you asked for help");
break;
//
case 'W':
System.out.println("Hmmm. You tried a -W with an incorrect long " +
"option name");
break;
//
case ':':
System.out.println("Doh! You need an argument for option " +
(char)g.getOptopt());
break;
//
case '?':
System.out.println("The option '" + (char)g.getOptopt() +
"' is not valid");
break;
//
default:
System.out.println("getopt() returned " + c);
break;
}
//
for (int i = g.getOptind(); i <32argv.length ; i++)
System.out.println("Non option argv element: " + argv[i] + "\n");
</pre>
<p/>
There is an alternative form of the constructor used for long options
above. This takes a trailing boolean flag. If set to false, Getopt
performs identically to the example, but if the boolean flag is true
then long options are allowed to start with a single '-' instead of
"--". If the first character of the option is a valid short option
character, then the option is treated as if it were the short option.
Otherwise it behaves as if the option is a long option. Note that
the name given to this option - long_only - is very counter-intuitive.
It does not cause only long options to be parsed but instead enables
the behavior described above.
<p/>
Note that the functionality and variable names used are driven from
the C lib version as this object is a port of the C code, not a
new implementation. This should aid in porting existing C/C++ code,
as well as helping programmers familiar with the glibc version to
adapt to the Java version even if it seems very non-Java at times.
<p/>
In this release I made all instance variables protected due to
overwhelming public demand. Any code which relied on optarg,
opterr, optind, or optopt being public will need to be modified to
use the appropriate access methods.
<p/>
Please send all bug reports, requests, and comments to
<a href="mailto:arenn@urbanophile.com">arenn@urbanophile.com</a>.
</div><div class="taglet"><dl class="tag list"></dl><dt class="tag section header"><b>Version:</b></dt><dd>1.0.7</dd></dl></div><div class="taglet"><dl class="tag list"><dt class="tag section header"><b>Authors:</b></dt><dd class="tag item">Roland McGrath (roland@gnu.ai.mit.edu)</dd><dd class="tag item">Ulrich Drepper (drepper@cygnus.com)</dd><dd class="tag item">Aaron M. Renn (arenn@urbanophile.com)</dd></dl></div><div class="taglet"></div><div class="taglet"></div><div class="taglet"><dl class="tag list"><dt class="tag section header"><b>See Also:</b></dt><dd><a href="../../gnu/getopt/LongOpt.html"><code>LongOpt</code></a></dd></dl></div><div class="taglet"></div><div class="taglet"></div><a name="summary-fields" id="summary-fields"/><dl class="table container"><dd><table class="class summary" border="1" width="100%"><tr class="table header"><td colspan="2"><h2 class="table header">Field Summary</h2></td></tr><tr><td class="left" valign="top"><code class="synopsis">protected static int</code></td><td class="right"><dl class="list"><dt class="synopsis"><code><a href="#PERMUTE">PERMUTE</a></code></dt><dd class="description"> PERMUTE is the default.</dd></dl></td></tr><tr><td class="left" valign="top"><code class="synopsis">protected static int</code></td><td class="right"><dl class="list"><dt class="synopsis"><code><a href="#REQUIRE_ORDER">REQUIRE_ORDER</a></code></dt><dd class="description"> Describe how to deal with options that follow non-option ARGV-elements.</dd></dl></td></tr><tr><td class="left" valign="top"><code class="synopsis">protected static int</code></td><td class="right"><dl class="list"><dt class="synopsis"><code><a href="#RETURN_IN_ORDER">RETURN_IN_ORDER</a></code></dt><dd class="description"> RETURN_IN_ORDER is an option available to programs that were written
to expect options and other ARGV-elements in any order and that care about
the ordering of the two.</dd></dl></td></tr><tr><td class="left" valign="top"><code class="synopsis">protected String[]</code></td><td class="right"><dl class="list"><dt class="synopsis"><code><a href="#argv">argv</a></code></dt><dd class="description"> Saved argument list passed to the program
</dd></dl></td></tr><tr><td class="left" valign="top"><code class="synopsis">protected int</code></td><td class="right"><dl class="list"><dt class="synopsis"><code><a href="#first_nonopt">first_nonopt</a></code></dt><dd class="description"> The index of the first non-option in argv[]
</dd></dl></td></tr><tr><td class="left" valign="top"><code class="synopsis">protected int</code></td><td class="right"><dl class="list"><dt class="synopsis"><code><a href="#last_nonopt">last_nonopt</a></code></dt><dd class="description"> The index of the last non-option in argv[]
</dd></dl></td></tr><tr><td class="left" valign="top"><code class="synopsis">protected boolean</code></td><td class="right"><dl class="list"><dt class="synopsis"><code><a href="#long_only">long_only</a></code></dt><dd class="description"> This flag determines whether or not we are parsing only long args
</dd></dl></td></tr><tr><td class="left" valign="top"><code class="synopsis">protected <a href="../../gnu/getopt/LongOpt.html" title="Class in gnu.getopt">LongOpt</a>[]</code></td><td class="right"><dl class="list"><dt class="synopsis"><code><a href="#long_options">long_options</a></code></dt><dd class="description"> This is an array of LongOpt objects which describ the valid long
options.</dd></dl></td></tr><tr><td class="left" valign="top"><code class="synopsis">protected int</code></td><td class="right"><dl class="list"><dt class="synopsis"><code><a href="#longind">longind</a></code></dt><dd class="description"> Stores the index into the long_options array of the long option found
</dd></dl></td></tr><tr><td class="left" valign="top"><code class="synopsis">protected boolean</code></td><td class="right"><dl class="list"><dt class="synopsis"><code><a href="#longopt_handled">longopt_handled</a></code></dt><dd class="description"> A flag which communicates whether or not checkLongOption() did all
necessary processing for the current option
</dd></dl></td></tr><tr><td class="left" valign="top"><code class="synopsis">protected String</code></td><td class="right"><dl class="list"><dt class="synopsis"><code><a href="#nextchar">nextchar</a></code></dt><dd class="description"> The next char to be scanned in the option-element
in which the last option character we returned was found.</dd></dl></td></tr><tr><td class="left" valign="top"><code class="synopsis">protected String</code></td><td class="right"><dl class="list"><dt class="synopsis"><code><a href="#optarg">optarg</a></code></dt><dd class="description"> For communication from `getopt' to the caller.</dd></dl></td></tr><tr><td class="left" valign="top"><code class="synopsis">protected boolean</code></td><td class="right"><dl class="list"><dt class="synopsis"><code><a href="#opterr">opterr</a></code></dt><dd class="description"> Callers store false here to inhibit the error message
for unrecognized options.</dd></dl></td></tr><tr><td class="left" valign="top"><code class="synopsis">protected int</code></td><td class="right"><dl class="list"><dt class="synopsis"><code><a href="#optind">optind</a></code></dt><dd class="description"> Index in ARGV of the next element to be scanned.</dd></dl></td></tr><tr><td class="left" valign="top"><code class="synopsis">protected int</code></td><td class="right"><dl class="list"><dt class="synopsis"><code><a href="#optopt">optopt</a></code></dt><dd class="description"> When an unrecognized option is encountered, getopt will return a '?'
and store the value of the invalid option here.</dd></dl></td></tr><tr><td class="left" valign="top"><code class="synopsis">protected String</code></td><td class="right"><dl class="list"><dt class="synopsis"><code><a href="#optstring">optstring</a></code></dt><dd class="description"> This is the string describing the valid short options.</dd></dl></td></tr><tr><td class="left" valign="top"><code class="synopsis">protected int</code></td><td class="right"><dl class="list"><dt class="synopsis"><code><a href="#ordering">ordering</a></code></dt><dd class="description"> Determines whether we permute arguments or not
</dd></dl></td></tr><tr><td class="left" valign="top"><code class="synopsis">protected boolean</code></td><td class="right"><dl class="list"><dt class="synopsis"><code><a href="#posixly_correct">posixly_correct</a></code></dt><dd class="description"> The flag determines whether or not we operate in strict POSIX compliance
</dd></dl></td></tr><tr><td class="left" valign="top"><code class="synopsis">protected String</code></td><td class="right"><dl class="list"><dt class="synopsis"><code><a href="#progname">progname</a></code></dt><dd class="description"> Name to print as the program name in error messages.</dd></dl></td></tr></table></dd></dl><a name="summary-constructors" id="summary-constructors"/><dl class="table container"><dd><table class="class summary" border="1" width="100%"><tr class="table header"><td colspan="2"><h2 class="table header">Constructor Summary</h2></td></tr><tr><td class="right"><dl class="list"><dt class="synopsis"><code><a href="#Getopt(String,String[],String)">Getopt</a>(String progname, String[] argv, String optstring)</code></dt><dd class="description"> Construct a basic Getopt instance with the given input data.</dd></dl></td></tr><tr><td class="right"><dl class="list"><dt class="synopsis"><code><a href="#Getopt(String,String[],String,gnu.getopt.LongOpt[])">Getopt</a>(String progname, String[] argv, String optstring, <a href="../../gnu/getopt/LongOpt.html" title="Class in gnu.getopt">LongOpt</a>[] long_options)</code></dt><dd class="description"> Construct a Getopt instance with given input data that is capable of
parsing long options as well as short.</dd></dl></td></tr><tr><td class="right"><dl class="list"><dt class="synopsis"><code><a href="#Getopt(String,String[],String,gnu.getopt.LongOpt[],boolean)">Getopt</a>(String progname, String[] argv, String optstring, <a href="../../gnu/getopt/LongOpt.html" title="Class in gnu.getopt">LongOpt</a>[] long_options, boolean long_only)</code></dt><dd class="description"> Construct a Getopt instance with given input data that is capable of
parsing long options and short options.</dd></dl></td></tr></table></dd></dl><a name="summary-methods" id="summary-methods"/><dl class="table container"><dd><table class="class summary" border="1" width="100%"><tr class="table header"><td colspan="2"><h2 class="table header">Method Summary</h2></td></tr><tr><td class="left" valign="top"><code class="synopsis">protected int</code></td><td class="right"><dl class="list"><dt class="synopsis"><code><a href="#checkLongOption()">checkLongOption</a>()</code></dt><dd class="description"> Check to see if an option is a valid long option.</dd></dl></td></tr><tr><td class="left" valign="top"><code class="synopsis">protected void</code></td><td class="right"><dl class="list"><dt class="synopsis"><code><a href="#exchange(String[])">exchange</a>(String[] argv)</code></dt><dd class="description"> Exchange the shorter segment with the far end of the longer segment.</dd></dl></td></tr><tr><td class="left" valign="top"><code class="synopsis"> int</code></td><td class="right"><dl class="list"><dt class="synopsis"><code><a href="#getLongind()">getLongind</a>()</code></dt><dd class="description"> Returns the index into the array of long options (NOT argv) representing
the long option that was found.</dd></dl></td></tr><tr><td class="left" valign="top"><code class="synopsis"> String</code></td><td class="right"><dl class="list"><dt class="synopsis"><code><a href="#getOptarg()">getOptarg</a>()</code></dt><dd class="description"> For communication from `getopt' to the caller.</dd></dl></td></tr><tr><td class="left" valign="top"><code class="synopsis"> int</code></td><td class="right"><dl class="list"><dt class="synopsis"><code><a href="#getOptind()">getOptind</a>()</code></dt><dd class="description"> optind it the index in ARGV of the next element to be scanned.</dd></dl></td></tr><tr><td class="left" valign="top"><code class="synopsis"> int</code></td><td class="right"><dl class="list"><dt class="synopsis"><code><a href="#getOptopt()">getOptopt</a>()</code></dt><dd class="description"> When getopt() encounters an invalid option, it stores the value of that
option in optopt which can be retrieved with this method.</dd></dl></td></tr><tr><td class="left" valign="top"><code class="synopsis"> int</code></td><td class="right"><dl class="list"><dt class="synopsis"><code><a href="#getopt()">getopt</a>()</code></dt><dd class="description"> This method returns a char that is the current option that has been
parsed from the command line.</dd></dl></td></tr><tr><td class="left" valign="top"><code class="synopsis"> void</code></td><td class="right"><dl class="list"><dt class="synopsis"><code><a href="#setArgv(String[])">setArgv</a>(String[] argv)</code></dt><dd class="description"> Since in GNU getopt() the argument vector is passed back in to the
function every time, the caller can swap out argv on the fly.</dd></dl></td></tr><tr><td class="left" valign="top"><code class="synopsis"> void</code></td><td class="right"><dl class="list"><dt class="synopsis"><code><a href="#setOpterr(boolean)">setOpterr</a>(boolean opterr)</code></dt><dd class="description"> Normally Getopt will print a message to the standard error when an
invalid option is encountered.</dd></dl></td></tr><tr><td class="left" valign="top"><code class="synopsis"> void</code></td><td class="right"><dl class="list"><dt class="synopsis"><code><a href="#setOptind(int)">setOptind</a>(int optind)</code></dt><dd class="description"> This method allows the optind index to be set manually.</dd></dl></td></tr><tr><td class="left" valign="top"><code class="synopsis"> void</code></td><td class="right"><dl class="list"><dt class="synopsis"><code><a href="#setOptstring(String)">setOptstring</a>(String optstring)</code></dt><dd class="description"> In GNU getopt, it is possible to change the string containg valid options
on the fly because it is passed as an argument to getopt() each time.</dd></dl></td></tr></table></dd></dl><a name="detail-fields" id="detail-fields"/><h2 class="section header">Field Details</h2><div class="section"><a name="PERMUTE" id="PERMUTE"/><div class="member detail outer"><h3 class="member detail name">PERMUTE</h3><pre class="member detail synopsis">protected static final int PERMUTE</pre><blockquote class="member detail name"><div class="member detail description"> PERMUTE is the default. We permute the contents of ARGV as we scan,
so that eventually all the non-options are at the end. This allows options
to be given in any order, even with programs that were not written to
expect this.
</div><div class="member detail thrown list"><dl><dt class="member detail thrown header"><b>Field Value:</b></dt><dd class="member detail thrown item">2</dd></dl></div><div class="taglet"></div><div class="taglet"></div><div class="taglet"></div><div class="taglet"></div><div class="taglet"></div></blockquote></div><hr/><a name="REQUIRE_ORDER" id="REQUIRE_ORDER"/><div class="member detail outer"><h3 class="member detail name">REQUIRE_ORDER</h3><pre class="member detail synopsis">protected static final int REQUIRE_ORDER</pre><blockquote class="member detail name"><div class="member detail description"> Describe how to deal with options that follow non-option ARGV-elements.
If the caller did not specify anything,
the default is REQUIRE_ORDER if the property
gnu.posixly_correct is defined, PERMUTE otherwise.
The special argument `--' forces an end of option-scanning regardless
of the value of `ordering'. In the case of RETURN_IN_ORDER, only
`--' can cause `getopt' to return -1 with `optind' != ARGC.
REQUIRE_ORDER means don't recognize them as options;
stop option processing when the first non-option is seen.
This is what Unix does.
This mode of operation is selected by either setting the property
gnu.posixly_correct, or using `+' as the first character
of the list of option characters.
</div><div class="member detail thrown list"><dl><dt class="member detail thrown header"><b>Field Value:</b></dt><dd class="member detail thrown item">1</dd></dl></div><div class="taglet"></div><div class="taglet"></div><div class="taglet"></div><div class="taglet"></div><div class="taglet"></div></blockquote></div><hr/><a name="RETURN_IN_ORDER" id="RETURN_IN_ORDER"/><div class="member detail outer"><h3 class="member detail name">RETURN_IN_ORDER</h3><pre class="member detail synopsis">protected static final int RETURN_IN_ORDER</pre><blockquote class="member detail name"><div class="member detail description"> RETURN_IN_ORDER is an option available to programs that were written
to expect options and other ARGV-elements in any order and that care about
the ordering of the two. We describe each non-option ARGV-element
as if it were the argument of an option with character code 1.
Using `-' as the first character of the list of option characters
selects this mode of operation.
</div><div class="member detail thrown list"><dl><dt class="member detail thrown header"><b>Field Value:</b></dt><dd class="member detail thrown item">3</dd></dl></div><div class="taglet"></div><div class="taglet"></div><div class="taglet"></div><div class="taglet"></div><div class="taglet"></div></blockquote></div><hr/><a name="argv" id="argv"/><div class="member detail outer"><h3 class="member detail name">argv</h3><pre class="member detail synopsis">protected String[] argv</pre><blockquote class="member detail name"><div class="member detail description"> Saved argument list passed to the program
</div><div class="taglet"></div><div class="taglet"></div><div class="taglet"></div><div class="taglet"></div><div class="taglet"></div></blockquote></div><hr/><a name="first_nonopt" id="first_nonopt"/><div class="member detail outer"><h3 class="member detail name">first_nonopt</h3><pre class="member detail synopsis">protected int first_nonopt</pre><blockquote class="member detail name"><div class="member detail description"> The index of the first non-option in argv[]
</div><div class="taglet"></div><div class="taglet"></div><div class="taglet"></div><div class="taglet"></div><div class="taglet"></div></blockquote></div><hr/><a name="last_nonopt" id="last_nonopt"/><div class="member detail outer"><h3 class="member detail name">last_nonopt</h3><pre class="member detail synopsis">protected int last_nonopt</pre><blockquote class="member detail name"><div class="member detail description"> The index of the last non-option in argv[]
</div><div class="taglet"></div><div class="taglet"></div><div class="taglet"></div><div class="taglet"></div><div class="taglet"></div></blockquote></div><hr/><a name="long_only" id="long_only"/><div class="member detail outer"><h3 class="member detail name">long_only</h3><pre class="member detail synopsis">protected boolean long_only</pre><blockquote class="member detail name"><div class="member detail description"> This flag determines whether or not we are parsing only long args
</div><div class="taglet"></div><div class="taglet"></div><div class="taglet"></div><div class="taglet"></div><div class="taglet"></div></blockquote></div><hr/><a name="long_options" id="long_options"/><div class="member detail outer"><h3 class="member detail name">long_options</h3><pre class="member detail synopsis">protected <a href="../../gnu/getopt/LongOpt.html" title="Class in gnu.getopt">LongOpt</a>[] long_options</pre><blockquote class="member detail name"><div class="member detail description"> This is an array of LongOpt objects which describ the valid long
options.
</div><div class="taglet"></div><div class="taglet"></div><div class="taglet"></div><div class="taglet"></div><div class="taglet"></div></blockquote></div><hr/><a name="longind" id="longind"/><div class="member detail outer"><h3 class="member detail name">longind</h3><pre class="member detail synopsis">protected int longind</pre><blockquote class="member detail name"><div class="member detail description"> Stores the index into the long_options array of the long option found
</div><div class="taglet"></div><div class="taglet"></div><div class="taglet"></div><div class="taglet"></div><div class="taglet"></div></blockquote></div><hr/><a name="longopt_handled" id="longopt_handled"/><div class="member detail outer"><h3 class="member detail name">longopt_handled</h3><pre class="member detail synopsis">protected boolean longopt_handled</pre><blockquote class="member detail name"><div class="member detail description"> A flag which communicates whether or not checkLongOption() did all
necessary processing for the current option
</div><div class="taglet"></div><div class="taglet"></div><div class="taglet"></div><div class="taglet"></div><div class="taglet"></div></blockquote></div><hr/><a name="nextchar" id="nextchar"/><div class="member detail outer"><h3 class="member detail name">nextchar</h3><pre class="member detail synopsis">protected String nextchar</pre><blockquote class="member detail name"><div class="member detail description"> The next char to be scanned in the option-element
in which the last option character we returned was found.
This allows us to pick up the scan where we left off.
If this is zero, or a null string, it means resume the scan
by advancing to the next ARGV-element.
</div><div class="taglet"></div><div class="taglet"></div><div class="taglet"></div><div class="taglet"></div><div class="taglet"></div></blockquote></div><hr/><a name="optarg" id="optarg"/><div class="member detail outer"><h3 class="member detail name">optarg</h3><pre class="member detail synopsis">protected String optarg</pre><blockquote class="member detail name"><div class="member detail description"> For communication from `getopt' to the caller.
When `getopt' finds an option that takes an argument,
the argument value is returned here.
Also, when `ordering' is RETURN_IN_ORDER,
each non-option ARGV-element is returned here.
</div><div class="taglet"></div><div class="taglet"></div><div class="taglet"></div><div class="taglet"></div><div class="taglet"></div></blockquote></div><hr/><a name="opterr" id="opterr"/><div class="member detail outer"><h3 class="member detail name">opterr</h3><pre class="member detail synopsis">protected boolean opterr</pre><blockquote class="member detail name"><div class="member detail description"> Callers store false here to inhibit the error message
for unrecognized options.
</div><div class="taglet"></div><div class="taglet"></div><div class="taglet"></div><div class="taglet"></div><div class="taglet"></div></blockquote></div><hr/><a name="optind" id="optind"/><div class="member detail outer"><h3 class="member detail name">optind</h3><pre class="member detail synopsis">protected int optind</pre><blockquote class="member detail name"><div class="member detail description"> Index in ARGV of the next element to be scanned.
This is used for communication to and from the caller
and for communication between successive calls to `getopt'.
On entry to `getopt', zero means this is the first call; initialize.
When `getopt' returns -1, this is the index of the first of the
non-option elements that the caller should itself scan.
Otherwise, `optind' communicates from one call to the next
how much of ARGV has been scanned so far.
</div><div class="taglet"></div><div class="taglet"></div><div class="taglet"></div><div class="taglet"></div><div class="taglet"></div></blockquote></div><hr/><a name="optopt" id="optopt"/><div class="member detail outer"><h3 class="member detail name">optopt</h3><pre class="member detail synopsis">protected int optopt</pre><blockquote class="member detail name"><div class="member detail description"> When an unrecognized option is encountered, getopt will return a '?'
and store the value of the invalid option here.
</div><div class="taglet"></div><div class="taglet"></div><div class="taglet"></div><div class="taglet"></div><div class="taglet"></div></blockquote></div><hr/><a name="optstring" id="optstring"/><div class="member detail outer"><h3 class="member detail name">optstring</h3><pre class="member detail synopsis">protected String optstring</pre><blockquote class="member detail name"><div class="member detail description"> This is the string describing the valid short options.
</div><div class="taglet"></div><div class="taglet"></div><div class="taglet"></div><div class="taglet"></div><div class="taglet"></div></blockquote></div><hr/><a name="ordering" id="ordering"/><div class="member detail outer"><h3 class="member detail name">ordering</h3><pre class="member detail synopsis">protected int ordering</pre><blockquote class="member detail name"><div class="member detail description"> Determines whether we permute arguments or not
</div><div class="taglet"></div><div class="taglet"></div><div class="taglet"></div><div class="taglet"></div><div class="taglet"></div></blockquote></div><hr/><a name="posixly_correct" id="posixly_correct"/><div class="member detail outer"><h3 class="member detail name">posixly_correct</h3><pre class="member detail synopsis">protected boolean posixly_correct</pre><blockquote class="member detail name"><div class="member detail description"> The flag determines whether or not we operate in strict POSIX compliance
</div><div class="taglet"></div><div class="taglet"></div><div class="taglet"></div><div class="taglet"></div><div class="taglet"></div></blockquote></div><hr/><a name="progname" id="progname"/><div class="member detail outer"><h3 class="member detail name">progname</h3><pre class="member detail synopsis">protected String progname</pre><blockquote class="member detail name"><div class="member detail description"> Name to print as the program name in error messages. This is necessary
since Java does not place the program name in argv[0]
</div><div class="taglet"></div><div class="taglet"></div><div class="taglet"></div><div class="taglet"></div><div class="taglet"></div></blockquote></div></div><a name="detail-constructors" id="detail-constructors"/><h2 class="section header">Constructor Details</h2><div class="section"><a name="Getopt(String,String[],String)" id="Getopt(String,String[],String)"/><div class="member detail outer"><h3 class="member detail name">Getopt</h3><pre class="member detail synopsis">public Getopt(String progname,
String[] argv,
String optstring)</pre><blockquote class="member detail name"><div class="member detail description"> Construct a basic Getopt instance with the given input data. Note that
this handles "short" options only.
</div><div class="parameter"><dl><dt class="header"><b>Parameters:</b></dt><dd class="item"><code class="name">progname</code><span class="separator"> - </span><span class="description">The name to display as the program name when printing errors</span></dd><dd class="item"><code class="name">argv</code><span class="separator"> - </span><span class="description">The String array passed as the command line to the program.</span></dd><dd class="item"><code class="name">optstring</code><span class="separator"> - </span><span class="description">A String containing a description of the valid args for this program</span></dd></dl></div><div class="taglet"></div><div class="taglet"></div><div class="taglet"></div><div class="taglet"></div><div class="taglet"></div></blockquote></div><hr/><a name="Getopt(String,String[],String,gnu.getopt.LongOpt[])" id="Getopt(String,String[],String,gnu.getopt.LongOpt[])"/><div class="member detail outer"><h3 class="member detail name">Getopt</h3><pre class="member detail synopsis">public Getopt(String progname,
String[] argv,
String optstring,
<a href="../../gnu/getopt/LongOpt.html" title="Class in gnu.getopt">LongOpt</a>[] long_options)</pre><blockquote class="member detail name"><div class="member detail description"> Construct a Getopt instance with given input data that is capable of
parsing long options as well as short.
</div><div class="parameter"><dl><dt class="header"><b>Parameters:</b></dt><dd class="item"><code class="name">progname</code><span class="separator"> - </span><span class="description">The name to display as the program name when printing errors</span></dd><dd class="item"><code class="name">argv</code><span class="separator"> - </span><span class="description">The String array passed as the command ilne to the program</span></dd><dd class="item"><code class="name">optstring</code><span class="separator"> - </span><span class="description">A String containing a description of the valid short args for this program</span></dd><dd class="item"><code class="name">long_options</code><span class="separator"> - </span><span class="description">An array of LongOpt objects that describes the valid long args for this program</span></dd></dl></div><div class="taglet"></div><div class="taglet"></div><div class="taglet"></div><div class="taglet"></div><div class="taglet"></div></blockquote></div><hr/><a name="Getopt(String,String[],String,gnu.getopt.LongOpt[],boolean)" id="Getopt(String,String[],String,gnu.getopt.LongOpt[],boolean)"/><div class="member detail outer"><h3 class="member detail name">Getopt</h3><pre class="member detail synopsis">public Getopt(String progname,
String[] argv,
String optstring,
<a href="../../gnu/getopt/LongOpt.html" title="Class in gnu.getopt">LongOpt</a>[] long_options,
boolean long_only)</pre><blockquote class="member detail name"><div class="member detail description"> Construct a Getopt instance with given input data that is capable of
parsing long options and short options. Contrary to what you might
think, the flag 'long_only' does not determine whether or not we
scan for only long arguments. Instead, a value of true here allows
long arguments to start with a '-' instead of '--' unless there is a
conflict with a short option name.
</div><div class="parameter"><dl><dt class="header"><b>Parameters:</b></dt><dd class="item"><code class="name">progname</code><span class="separator"> - </span><span class="description">The name to display as the program name when printing errors</span></dd><dd class="item"><code class="name">argv</code><span class="separator"> - </span><span class="description">The String array passed as the command ilne to the program</span></dd><dd class="item"><code class="name">optstring</code><span class="separator"> - </span><span class="description">A String containing a description of the valid short args for this program</span></dd><dd class="item"><code class="name">long_options</code><span class="separator"> - </span><span class="description">An array of LongOpt objects that describes the valid long args for this program</span></dd><dd class="item"><code class="name">long_only</code><span class="separator"> - </span><span class="description">true if long options that do not conflict with short options can start with a '-' as well as '--'</span></dd></dl></div><div class="taglet"></div><div class="taglet"></div><div class="taglet"></div><div class="taglet"></div><div class="taglet"></div></blockquote></div></div><a name="detail-methods" id="detail-methods"/><h2 class="section header">Method Details</h2><div class="section"><a name="checkLongOption()" id="checkLongOption()"/><div class="member detail outer"><h3 class="member detail name">checkLongOption</h3><pre class="member detail synopsis">protected int checkLongOption()</pre><blockquote class="member detail name"><div class="member detail description"> Check to see if an option is a valid long option. Called by getopt().
Put in a separate method because this needs to be done twice. (The
C getopt authors just copy-pasted the code!).
</div><div class="parameter"><dl><dt class="header"><b>Parameters:</b></dt></dl></div><div class="member detail return list"><dl><dt class="member detail return header"><b>Returns:</b></dt><dd class="member detail return item">Various things depending on circumstances</dd></dl></div><div class="taglet"></div><div class="taglet"></div><div class="taglet"></div><div class="taglet"></div><div class="taglet"></div></blockquote></div><hr/><a name="exchange(String[])" id="exchange(String[])"/><div class="member detail outer"><h3 class="member detail name">exchange</h3><pre class="member detail synopsis">protected void exchange(String[] argv)</pre><blockquote class="member detail name"><div class="member detail description"> Exchange the shorter segment with the far end of the longer segment.
That puts the shorter segment into the right place.
It leaves the longer segment in the right place overall,
but it consists of two parts that need to be swapped next.
This method is used by getopt() for argument permutation.
</div><div class="taglet"></div><div class="taglet"></div><div class="taglet"></div><div class="taglet"></div><div class="taglet"></div></blockquote></div><hr/><a name="getLongind()" id="getLongind()"/><div class="member detail outer"><h3 class="member detail name">getLongind</h3><pre class="member detail synopsis">public int getLongind()</pre><blockquote class="member detail name"><div class="member detail description"> Returns the index into the array of long options (NOT argv) representing
the long option that was found.
</div><div class="taglet"></div><div class="taglet"></div><div class="taglet"></div><div class="taglet"></div><div class="taglet"></div></blockquote></div><hr/><a name="getOptarg()" id="getOptarg()"/><div class="member detail outer"><h3 class="member detail name">getOptarg</h3><pre class="member detail synopsis">public String getOptarg()</pre><blockquote class="member detail name"><div class="member detail description"> For communication from `getopt' to the caller.
When `getopt' finds an option that takes an argument,
the argument value is returned here.
Also, when `ordering' is RETURN_IN_ORDER,
each non-option ARGV-element is returned here.
No set method is provided because setting this variable has no effect.
</div><div class="taglet"></div><div class="taglet"></div><div class="taglet"></div><div class="taglet"></div><div class="taglet"></div></blockquote></div><hr/><a name="getOptind()" id="getOptind()"/><div class="member detail outer"><h3 class="member detail name">getOptind</h3><pre class="member detail synopsis">public int getOptind()</pre><blockquote class="member detail name"><div class="member detail description"> optind it the index in ARGV of the next element to be scanned.
This is used for communication to and from the caller
and for communication between successive calls to `getopt'.
When `getopt' returns -1, this is the index of the first of the
non-option elements that the caller should itself scan.
Otherwise, `optind' communicates from one call to the next
how much of ARGV has been scanned so far.
</div><div class="taglet"></div><div class="taglet"></div><div class="taglet"></div><div class="taglet"></div><div class="taglet"></div></blockquote></div><hr/><a name="getOptopt()" id="getOptopt()"/><div class="member detail outer"><h3 class="member detail name">getOptopt</h3><pre class="member detail synopsis">public int getOptopt()</pre><blockquote class="member detail name"><div class="member detail description"> When getopt() encounters an invalid option, it stores the value of that
option in optopt which can be retrieved with this method. There is
no corresponding set method because setting this variable has no effect.
</div><div class="taglet"></div><div class="taglet"></div><div class="taglet"></div><div class="taglet"></div><div class="taglet"></div></blockquote></div><hr/><a name="getopt()" id="getopt()"/><div class="member detail outer"><h3 class="member detail name">getopt</h3><pre class="member detail synopsis">public int getopt()</pre><blockquote class="member detail name"><div class="member detail description"> This method returns a char that is the current option that has been
parsed from the command line. If the option takes an argument, then
the internal variable 'optarg' is set which is a String representing
the the value of the argument. This value can be retrieved by the
caller using the getOptarg() method. If an invalid option is found,
an error message is printed and a '?' is returned. The name of the
invalid option character can be retrieved by calling the getOptopt()
method. When there are no more options to be scanned, this method
returns -1. The index of first non-option element in argv can be
retrieved with the getOptind() method.
</div><div class="member detail return list"><dl><dt class="member detail return header"><b>Returns:</b></dt><dd class="member detail return item">Various things as described above</dd></dl></div><div class="taglet"></div><div class="taglet"></div><div class="taglet"></div><div class="taglet"></div><div class="taglet"></div></blockquote></div><hr/><a name="setArgv(String[])" id="setArgv(String[])"/><div class="member detail outer"><h3 class="member detail name">setArgv</h3><pre class="member detail synopsis">public void setArgv(String[] argv)</pre><blockquote class="member detail name"><div class="member detail description"> Since in GNU getopt() the argument vector is passed back in to the
function every time, the caller can swap out argv on the fly. Since
passing argv is not required in the Java version, this method allows
the user to override argv. Note that incorrect use of this method can
lead to serious lossage.
</div><div class="parameter"><dl><dt class="header"><b>Parameters:</b></dt><dd class="item"><code class="name">argv</code><span class="separator"> - </span><span class="description">New argument list</span></dd></dl></div><div class="taglet"></div><div class="taglet"></div><div class="taglet"></div><div class="taglet"></div><div class="taglet"></div></blockquote></div><hr/><a name="setOpterr(boolean)" id="setOpterr(boolean)"/><div class="member detail outer"><h3 class="member detail name">setOpterr</h3><pre class="member detail synopsis">public void setOpterr(boolean opterr)</pre><blockquote class="member detail name"><div class="member detail description"> Normally Getopt will print a message to the standard error when an
invalid option is encountered. This can be suppressed (or re-enabled)
by calling this method. There is no get method for this variable
because if you can't remember the state you set this to, why should I?
</div><div class="taglet"></div><div class="taglet"></div><div class="taglet"></div><div class="taglet"></div><div class="taglet"></div></blockquote></div><hr/><a name="setOptind(int)" id="setOptind(int)"/><div class="member detail outer"><h3 class="member detail name">setOptind</h3><pre class="member detail synopsis">public void setOptind(int optind)</pre><blockquote class="member detail name"><div class="member detail description"> This method allows the optind index to be set manually. Normally this
is not necessary (and incorrect usage of this method can lead to serious
lossage), but optind is a public symbol in GNU getopt, so this method
was added to allow it to be modified by the caller if desired.
</div><div class="parameter"><dl><dt class="header"><b>Parameters:</b></dt><dd class="item"><code class="name">optind</code><span class="separator"> - </span><span class="description">The new value of optind</span></dd></dl></div><div class="taglet"></div><div class="taglet"></div><div class="taglet"></div><div class="taglet"></div><div class="taglet"></div></blockquote></div><hr/><a name="setOptstring(String)" id="setOptstring(String)"/><div class="member detail outer"><h3 class="member detail name">setOptstring</h3><pre class="member detail synopsis">public void setOptstring(String optstring)</pre><blockquote class="member detail name"><div class="member detail description"> In GNU getopt, it is possible to change the string containg valid options
on the fly because it is passed as an argument to getopt() each time. In
this version we do not pass the string on every call. In order to allow
dynamic option string changing, this method is provided.
</div><div class="parameter"><dl><dt class="header"><b>Parameters:</b></dt><dd class="item"><code class="name">optstring</code><span class="separator"> - </span><span class="description">The new option string to use</span></dd></dl></div><div class="taglet"></div><div class="taglet"></div><div class="taglet"></div><div class="taglet"></div><div class="taglet"></div></blockquote></div></div><p class="navbar bottom spacer"> </p><table class="navbar div bottom"><tr><td><div class="navbar div top"><span class="navbar item enabled"><a href="../../overview-summary.html">Overview</a></span> <span class="navbar item enabled"><a href="package-summary.html">Package</a></span> <span class="navbar item enabled"><a href="tree.html">Tree</a></span> <span class="navbar item enabled"><a href="../../alphaindex.html">Index</a></span> <span class="navbar item enabled"><a href="../../deprecated.html">Deprecated</a></span> <span class="navbar item enabled"><a href="../../about.html">About</a></span></div></td></tr></table></body></html>