public class CommandLine extends Object
Option, while
 will be initialized automatically by the constructor. The following options are automatically
 recognized by this class:
 
| -encoding | Set the input and output encoding. | 
| -help | Print the help summary. | 
| -locale | Set the locale for string, number and date formatting. | 
| Modifier and Type | Field and Description | 
|---|---|
| static int | ABORT_EXIT_CODEThe code given to  System.exit(int)when the program aborted at user request. | 
| protected String[] | argumentsThe remaining arguments after all option values have been assigned to the fields. | 
| static int | BAD_CONTENT_EXIT_CODEThe code given to  System.exit(int)when the program failed because of bad content in a
 file. | 
| protected PrintWriter | errError stream to the console. | 
| static int | ILLEGAL_ARGUMENT_EXIT_CODEThe code given to  System.exit(int)when the program failed because of an illegal user
 argument. | 
| static int | IO_EXCEPTION_EXIT_CODEThe code given to  System.exit(int)when the program failed because of anIOException. | 
| protected Locale | localeThe locale inferred from the  "-locale"option. | 
| protected PrintWriter | outOutput stream to the console. | 
| static int | SQL_EXCEPTION_EXIT_CODEThe code given to  System.exit(int)when the program failed because of aSQLException. | 
| Modifier | Constructor and Description | 
|---|---|
| protected  | CommandLine(String[] args)Creates a new  CommandLineinstance from the given arguments. | 
| protected  | CommandLine(String[] args,
           int maximumRemaining)Creates a new  CommandLineinstance from the given arguments. | 
| Modifier and Type | Method and Description | 
|---|---|
| protected void | help()Prints a description of all arguments to the standard output. | 
| protected <T> T | parse(Class<T> type,
     String value)Parses the given string as a value of the given type. | 
public static final int ILLEGAL_ARGUMENT_EXIT_CODE
System.exit(int) when the program failed because of an illegal user
 argument.public static final int ABORT_EXIT_CODE
System.exit(int) when the program aborted at user request.public static final int BAD_CONTENT_EXIT_CODE
System.exit(int) when the program failed because of bad content in a
 file.public static final int IO_EXCEPTION_EXIT_CODE
System.exit(int) when the program failed because of an IOException.public static final int SQL_EXCEPTION_EXIT_CODE
System.exit(int) when the program failed because of a SQLException.protected final PrintWriter out
"-encoding" argument, if presents.protected final PrintWriter err
protected final Locale locale
"-locale" option. If no such option was provided, then
 this field is set to the default locale.protected final String[] arguments
protected CommandLine(String[] args)
CommandLine instance from the given arguments. This constructor expects
 no additional argument after the one annoted as Option.args - The command-line arguments.protected CommandLine(String[] args, int maximumRemaining)
CommandLine instance from the given arguments. If this constructor
 fails because of a programming error (for example a type not handled by parse
 method), then an exception is thrown like usual. If this constructor fails because of some
 user error (e.g. if a mandatory argument is not provided) or some other external conditions
 (e.g. an IOException), then it prints a short error message and invokes System.exit(int) with one the EXIT_CODE constants.args - The command-line arguments.maximumRemaining - The maximum number of arguments that may remain after processing of
     annotated fields. This is the maximum length of the arguments array. The default
     value is 0.protected <T> T parse(Class<T> type, String value) throws UnsupportedOperationException
T - The field type.type - The field type.value - The value given on the command line.UnsupportedOperationException - if the value can't be parsed.protected void help()
--help argument on the command
 line. Subclasses can override this method in order to prints a summary before the option
 list.Copyright © 1996–2019 Geotools. All rights reserved.