Java Doc for CmdLn.java in  » Template-Engine » ostermillerutils » com » Ostermiller » util » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Template Engine » ostermillerutils » com.Ostermiller.util 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.Ostermiller.util.CmdLn

CmdLn
final public class CmdLn (Code)
Command line argument parser for Java command line programs. More information about this class and code samples for suggested use are available from ostermiller.org.
author:
   Stephen Ostermiller http://ostermiller.org/contact.pl?regarding=Java+Utilities
since:
   ostermillerutils 1.07.00



Constructor Summary
public  CmdLn(String[] arguments)
    

Method Summary
public  CmdLnaddOption(CmdLnOption option)
     Add option.
Parameters:
  option - option to be added.
throws:
  NullPointerException - if the option is null.
throws:
  IllegalStateException - if the command line has already been parsed.
public  CmdLnaddOptions(Collection<CmdLnOption> options)
     Add options.
Parameters:
  options - options to be added.
throws:
  NullPointerException - if the options are null.
throws:
  NullPointerException - if any option in the collection is null.
throws:
  IllegalStateException - if the command line has already been parsed.
public  CmdLnaddOptions(CmdLnOption[] options)
     Add options.
Parameters:
  options - options to be added.
throws:
  NullPointerException - if the options are null.
throws:
  NullPointerException - if any option in the collection is null.
throws:
  IllegalStateException - if the command line has already been parsed.
 StringgetFirstLongOptionsStart()
     Get the canonical start of long options.
 StringgetFirstShortOptionsStart()
     Get the canonical start of short options.
public  StringgetHelp()
     Print help for the command line options.
public  StringgetHelp(int indent, int width)
     Print help for the command line options.
public  List<String>getNonOptionArguments()
     Get the left over arguments -- the arguments that are not associated with any arguments.
public  CmdLnResultgetResult(String s)
     Get the last result associated with the given argument.
public  CmdLnResultgetResult(Character c)
     Get the last result associated with the given argument.
public  CmdLnResultgetResult(char c)
     Get the last result associated with the given argument.
public  CmdLnResultgetResult(CmdLnOption option)
     Get the last result associated with the option.
public  List<CmdLnResult>getResults()
     Get all the results in the order in which they appear in the command line.
public  List<CmdLnResult>getResults(String s)
     Get all the results associated with the given argument in the order in which they appear in the command line.
public  List<CmdLnResult>getResults(Character c)
     Get all the results associated with the given argument in the order in which they appear in the command line.
public  List<CmdLnResult>getResults(char c)
     Get all the results associated with the given argument in the order in which they appear in the command line.
public  List<CmdLnResult>getResults(CmdLnOption option)
     Get all the results associated with the given argument in the order in which they appear in the command line.
public  intoccurrences(String s)
     The number of times the specified option is present in the command line.
public  intoccurrences(Character c)
     The number of times the specified option is present in the command line.
public  intoccurrences(char c)
     The number of times the specified option is present in the command line.
public  intoccurrences(CmdLnOption option)
     The number of times the specified option is present in the command line.
public  voidparse()
     Parse the command line options if they have not already been parsed.
public  booleanpresent(String s)
     Whether or not the specified option is present in the command line.
public  booleanpresent(Character c)
     Whether or not the specified option is present in the command line.
public  booleanpresent(char c)
     Whether or not the specified option is present in the command line.
public  booleanpresent(CmdLnOption option)
     Whether or not the specified option is present in the command line.
public  voidprintHelp()
     Print help for the command line options to standard output.
public  voidprintHelp(OutputStream out)
     Print help for the command line options.
public  voidprintHelp(Writer out)
     Print help for the command line options.
public  voidprintHelp(PrintWriter out)
     Print help for the command line options.
public  voidprintHelp(int indent, int width)
     Print help for the command line options to standard output.
public  voidprintHelp(OutputStream out, int indent, int width)
     Print help for the command line options.
public  voidprintHelp(Writer out, int indent, int width)
     Print help for the command line options.
public  voidprintHelp(PrintWriter out, int indent, int width)
     Print help for the command line options.
public  CmdLnsetDescription(String description)
     Set the description for the program.
public  CmdLnsetNonOptionSeparators(String[] nonOptionSeparators)
     Set the "stop" option that causes any following arguments to be treated as non-option arguments, even if they look like an option.

The default non-option separator is "--".
Parameters:
  nonOptionSeparators - List of arguments that stop processing options and treat remaining arguments as non option arguments.

public  CmdLnsetOptionArgumentDelimiters(char[] delimiters)
     Set the delimiters that separate a option name from a value within a single argument. This is to support arguments of the form "--name=value".
public  CmdLnsetOptionStarts(String longOptionsStart, String shortOptionsStart)
     Set what long options and short options start with.
public  CmdLnsetOptionStarts(String[] longOptionsStart, String[] shortOptionsStart)
     Set what long options and short options start with.


Constructor Detail
CmdLn
public CmdLn(String[] arguments)(Code)
New command line options with the given command line arguments
Parameters:
  arguments - command line arguments from main method
since:
   ostermillerutils 1.07.00




Method Detail
addOption
public CmdLn addOption(CmdLnOption option)(Code)
Add option.
Parameters:
  option - option to be added.
throws:
  NullPointerException - if the option is null.
throws:
  IllegalStateException - if the command line has already been parsed. this for method chaining
since:
   ostermillerutils 1.07.00



addOptions
public CmdLn addOptions(Collection<CmdLnOption> options)(Code)
Add options.
Parameters:
  options - options to be added.
throws:
  NullPointerException - if the options are null.
throws:
  NullPointerException - if any option in the collection is null.
throws:
  IllegalStateException - if the command line has already been parsed. this for method chaining
since:
   ostermillerutils 1.07.00



addOptions
public CmdLn addOptions(CmdLnOption[] options)(Code)
Add options.
Parameters:
  options - options to be added.
throws:
  NullPointerException - if the options are null.
throws:
  NullPointerException - if any option in the collection is null.
throws:
  IllegalStateException - if the command line has already been parsed. this for method chaining
since:
   ostermillerutils 1.07.00



getFirstLongOptionsStart
String getFirstLongOptionsStart()(Code)
Get the canonical start of long options. (Usually "--") the first long option start
since:
   ostermillerutils 1.07.00



getFirstShortOptionsStart
String getFirstShortOptionsStart()(Code)
Get the canonical start of short options. (Usually "-") the first short option start
since:
   ostermillerutils 1.07.00



getHelp
public String getHelp()(Code)
Print help for the command line options. Help will be in this format:
 program description
 --argument -a   argument a description
 --another -b       argument b description
 --third -c      argument c description
 
Indentation is the default twenty, and line width is the default 80. Parses the command line if not already parsed. Help as a string.
throws:
  UnknownCmdLnOptionException - if an unexpected option is encountered during parsing.
throws:
  MissingCmdLnArgumentException - if a command line option does not have enough arguments during parsing.
since:
   ostermillerutils 1.07.00



getHelp
public String getHelp(int indent, int width)(Code)
Print help for the command line options. Help will be in this format:
 program description
 --argument -a   argument a description
 --another -b       argument b description
 --third -c      argument c description
 
Parses the command line if not already parsed. Help as a string.
Parameters:
  indent - the maximum number of characters to which all descriptions should be indented.
Parameters:
  width - the number of characters at which text should be wrapped.
throws:
  UnknownCmdLnOptionException - if an unexpected option is encountered during parsing.
throws:
  MissingCmdLnArgumentException - if a command line option does not have enough arguments during parsing.
since:
   ostermillerutils 1.07.00



getNonOptionArguments
public List<String> getNonOptionArguments()(Code)
Get the left over arguments -- the arguments that are not associated with any arguments. Parses the command line if not already parsed. unmodifiable list of arguments
throws:
  UnknownCmdLnOptionException - if an unexpected option is encountered during parsing.
throws:
  MissingCmdLnArgumentException - if a command line option does not have enough arguments during parsing.
throws:
  ExtraCmdLnArgumentException - if a command line option has too many arguments during parsing.
since:
   ostermillerutils 1.07.00



getResult
public CmdLnResult getResult(String s)(Code)
Get the last result associated with the given argument. If a option is in the command line multiple times, typically the last one should be the one that wins as an override mechanism. Parses the command line if not already parsed.
Parameters:
  s - long argument result for argument, or null if not associated with an option or not present in the command line.
throws:
  UnknownCmdLnOptionException - if an unexpected option is encountered during parsing.
throws:
  MissingCmdLnArgumentException - if a command line option does not have enough arguments during parsing.
throws:
  ExtraCmdLnArgumentException - if a command line option has too many arguments during parsing.
since:
   ostermillerutils 1.07.00



getResult
public CmdLnResult getResult(Character c)(Code)
Get the last result associated with the given argument. If a option is in the command line multiple times, typically the last one should be the one that wins as an override mechanism. Parses the command line if not already parsed.
Parameters:
  c - short argument result for argument, or null if not associated with an option or not present in the command line.
throws:
  UnknownCmdLnOptionException - if an unexpected option is encountered during parsing.
throws:
  MissingCmdLnArgumentException - if a command line option does not have enough arguments during parsing.
throws:
  ExtraCmdLnArgumentException - if a command line option has too many arguments during parsing.
since:
   ostermillerutils 1.07.00



getResult
public CmdLnResult getResult(char c)(Code)
Get the last result associated with the given argument. If a option is in the command line multiple times, typically the last one should be the one that wins as an override mechanism. Parses the command line if not already parsed.
Parameters:
  c - short argument result for argument, or null if not associated with an option or not present in the command line.
throws:
  UnknownCmdLnOptionException - if an unexpected option is encountered during parsing.
throws:
  MissingCmdLnArgumentException - if a command line option does not have enough arguments during parsing.
throws:
  ExtraCmdLnArgumentException - if a command line option has too many arguments during parsing.
since:
   ostermillerutils 1.07.00



getResult
public CmdLnResult getResult(CmdLnOption option)(Code)
Get the last result associated with the option. If a option is in the command line multiple times, typically the last one should be the one that wins as an override mechanism. Parses the command line if not already parsed.
Parameters:
  option - command line option result for argument, or null if option not added to this command line or not present in the command line.
throws:
  UnknownCmdLnOptionException - if an unexpected option is encountered during parsing.
throws:
  MissingCmdLnArgumentException - if a command line option does not have enough arguments during parsing.
throws:
  ExtraCmdLnArgumentException - if a command line option has too many arguments during parsing.
since:
   ostermillerutils 1.07.00



getResults
public List<CmdLnResult> getResults()(Code)
Get all the results in the order in which they appear in the command line. Parses the command line if not already parsed. unmodifiable list of all options and arguments that were specified on the command line
throws:
  UnknownCmdLnOptionException - if an unexpected option is encountered during parsing.
throws:
  MissingCmdLnArgumentException - if a command line option does not have enough arguments during parsing.
throws:
  ExtraCmdLnArgumentException - if a command line option has too many arguments during parsing.
since:
   ostermillerutils 1.07.00



getResults
public List<CmdLnResult> getResults(String s)(Code)
Get all the results associated with the given argument in the order in which they appear in the command line. If a option is in the command line multiple times, typically the last one should be the one that wins as an override mechanism, however it may sometimes be useful to know about all of them. Parses the command line if not already parsed.
Parameters:
  s - long argument results for argument, or null if not associated with an option or not present in the command line.
throws:
  UnknownCmdLnOptionException - if an unexpected option is encountered during parsing.
throws:
  MissingCmdLnArgumentException - if a command line option does not have enough arguments during parsing.
throws:
  ExtraCmdLnArgumentException - if a command line option has too many arguments during parsing.
since:
   ostermillerutils 1.07.00



getResults
public List<CmdLnResult> getResults(Character c)(Code)
Get all the results associated with the given argument in the order in which they appear in the command line. If a option is in the command line multiple times, typically the last one should be the one that wins as an override mechanism, however it may sometimes be useful to know about all of them. Parses the command line if not already parsed.
Parameters:
  c - short argument results for argument, or null if not associated with an option or not present in the command line.
throws:
  UnknownCmdLnOptionException - if an unexpected option is encountered during parsing.
throws:
  MissingCmdLnArgumentException - if a command line option does not have enough arguments during parsing.
since:
   ostermillerutils 1.07.00



getResults
public List<CmdLnResult> getResults(char c)(Code)
Get all the results associated with the given argument in the order in which they appear in the command line. If a option is in the command line multiple times, typically the last one should be the one that wins as an override mechanism, however it may sometimes be useful to know about all of them. Parses the command line if not already parsed.
Parameters:
  c - short argument results for argument, or null if not associated with an option or not present in the command line.
throws:
  UnknownCmdLnOptionException - if an unexpected option is encountered during parsing.
throws:
  MissingCmdLnArgumentException - if a command line option does not have enough arguments during parsing.
throws:
  ExtraCmdLnArgumentException - if a command line option has too many arguments during parsing.
since:
   ostermillerutils 1.07.00



getResults
public List<CmdLnResult> getResults(CmdLnOption option)(Code)
Get all the results associated with the given argument in the order in which they appear in the command line. If a option is in the command line multiple times, typically the last one should be the one that wins as an override mechanism, however it may sometimes be useful to know about all of them. Parses the command line if not already parsed.
Parameters:
  option - command line option results for option, or null if option not added to this command line or not present in the command line.
throws:
  UnknownCmdLnOptionException - if an unexpected option is encountered during parsing.
throws:
  MissingCmdLnArgumentException - if a command line option does not have enough arguments during parsing.
throws:
  ExtraCmdLnArgumentException - if a command line option has too many arguments during parsing.
since:
   ostermillerutils 1.07.00



occurrences
public int occurrences(String s)(Code)
The number of times the specified option is present in the command line. Parses the command line if not already parsed.
Parameters:
  s - long argument true iff the option (or its synonyms) is present.
throws:
  UnknownCmdLnOptionException - if an unexpected option is encountered during parsing.
throws:
  MissingCmdLnArgumentException - if a command line option does not have enough arguments during parsing.
throws:
  ExtraCmdLnArgumentException - if a command line option has too many arguments during parsing.
since:
   ostermillerutils 1.07.00



occurrences
public int occurrences(Character c)(Code)
The number of times the specified option is present in the command line. Parses the command line if not already parsed.
Parameters:
  c - short argument true iff the option (or its synonyms) is present.
throws:
  UnknownCmdLnOptionException - if an unexpected option is encountered during parsing.
throws:
  MissingCmdLnArgumentException - if a command line option does not have enough arguments during parsing.
throws:
  ExtraCmdLnArgumentException - if a command line option has too many arguments during parsing.
since:
   ostermillerutils 1.07.00



occurrences
public int occurrences(char c)(Code)
The number of times the specified option is present in the command line. Parses the command line if not already parsed.
Parameters:
  c - short argument true iff the option (or its synonyms) is present.
throws:
  UnknownCmdLnOptionException - if an unexpected option is encountered during parsing.
throws:
  MissingCmdLnArgumentException - if a command line option does not have enough arguments during parsing.
throws:
  ExtraCmdLnArgumentException - if a command line option has too many arguments during parsing.
since:
   ostermillerutils 1.07.00



occurrences
public int occurrences(CmdLnOption option)(Code)
The number of times the specified option is present in the command line. Parses the command line if not already parsed.
Parameters:
  option - command line option true iff the option is present.
throws:
  UnknownCmdLnOptionException - if an unexpected option is encountered during parsing.
throws:
  MissingCmdLnArgumentException - if a command line option does not have enough arguments during parsing.
throws:
  ExtraCmdLnArgumentException - if a command line option has too many arguments during parsing.
since:
   ostermillerutils 1.07.00



parse
public void parse()(Code)
Parse the command line options if they have not already been parsed. Process the options, run through the arguments, ensure that all the arguments are good, call any listeners.

Once this command line has been parsed, options may no longer be added.
throws:
  UnknownCmdLnOptionException - if an unexpected option is encountered
throws:
  MissingCmdLnArgumentException - if a command line option does not have enough arguments.
throws:
  ExtraCmdLnArgumentException - if a command line option has too many arguments.
since:
   ostermillerutils 1.07.00




present
public boolean present(String s)(Code)
Whether or not the specified option is present in the command line. Parses the command line if not already parsed.
Parameters:
  s - long argument true iff the option (or its synonyms) is present.
throws:
  UnknownCmdLnOptionException - if an unexpected option is encountered during parsing.
throws:
  MissingCmdLnArgumentException - if a command line option does not have enough arguments during parsing.
throws:
  ExtraCmdLnArgumentException - if a command line option has too many arguments during parsing.
since:
   ostermillerutils 1.07.00



present
public boolean present(Character c)(Code)
Whether or not the specified option is present in the command line. Parses the command line if not already parsed.
Parameters:
  c - short argument true iff the option (or its synonyms) is present.
throws:
  UnknownCmdLnOptionException - if an unexpected option is encountered during parsing.
throws:
  MissingCmdLnArgumentException - if a command line option does not have enough arguments during parsing.
throws:
  ExtraCmdLnArgumentException - if a command line option has too many arguments during parsing.
since:
   ostermillerutils 1.07.00



present
public boolean present(char c)(Code)
Whether or not the specified option is present in the command line. Parses the command line if not already parsed.
Parameters:
  c - short argument true iff the option (or its synonyms) is present.
throws:
  UnknownCmdLnOptionException - if an unexpected option is encountered during parsing.
throws:
  MissingCmdLnArgumentException - if a command line option does not have enough arguments during parsing.
throws:
  ExtraCmdLnArgumentException - if a command line option has too many arguments during parsing.
since:
   ostermillerutils 1.07.00



present
public boolean present(CmdLnOption option)(Code)
Whether or not the specified option is present in the command line. Parses the command line if not already parsed.
Parameters:
  option - command line option true iff the option is present.
throws:
  UnknownCmdLnOptionException - if an unexpected option is encountered during parsing.
throws:
  MissingCmdLnArgumentException - if a command line option does not have enough arguments during parsing.
throws:
  ExtraCmdLnArgumentException - if a command line option has too many arguments during parsing.
since:
   ostermillerutils 1.07.00



printHelp
public void printHelp()(Code)
Print help for the command line options to standard output. Help will be in this format:
 program description
 --argument -a   argument a description
 --another -b       argument b description
 --third -c      argument c description
 
Indentation is the default twenty, and line width is the default eighty. Parses the command line if not already parsed.
throws:
  UnknownCmdLnOptionException - if an unexpected option is encountered during parsing.
throws:
  MissingCmdLnArgumentException - if a command line option does not have enough arguments during parsing.
since:
   ostermillerutils 1.07.00



printHelp
public void printHelp(OutputStream out)(Code)
Print help for the command line options. Indentation is the default twenty, and line width is the default eighty. Parses the command line if not already parsed.
Parameters:
  out - destination to which the help is written.
throws:
  UnknownCmdLnOptionException - if an unexpected option is encountered during parsing.
throws:
  MissingCmdLnArgumentException - if a command line option does not have enough arguments during parsing.
since:
   ostermillerutils 1.07.00



printHelp
public void printHelp(Writer out)(Code)
Print help for the command line options. Help will be in this format:
 program description
 --argument -a   argument a description
 --another -b       argument b description
 --third -c      argument c description
 
Indentation is the default twenty, and line width is the default eighty. Parses the command line if not already parsed.
Parameters:
  out - destination to which the help is written.
throws:
  UnknownCmdLnOptionException - if an unexpected option is encountered during parsing.
throws:
  MissingCmdLnArgumentException - if a command line option does not have enough arguments during parsing.
since:
   ostermillerutils 1.07.00



printHelp
public void printHelp(PrintWriter out)(Code)
Print help for the command line options. Help will be in this format:
 program description
 --argument -a   argument a description
 --another -b       argument b description
 --third -c      argument c description
 
Indentation is the default twenty, and line width is the default eighty. Parses the command line if not already parsed.
Parameters:
  out - destination to which the help is written.
throws:
  UnknownCmdLnOptionException - if an unexpected option is encountered during parsing.
throws:
  MissingCmdLnArgumentException - if a command line option does not have enough arguments during parsing.
since:
   ostermillerutils 1.07.00



printHelp
public void printHelp(int indent, int width)(Code)
Print help for the command line options to standard output. Help will be in this format:
 program description
 --argument -a   argument a description
 --another -b       argument b description
 --third -c      argument c description
 
Parses the command line if not already parsed.
Parameters:
  indent - the maximum number of characters to which all descriptions should be indented.
Parameters:
  width - the number of characters at which text should be wrapped.
throws:
  UnknownCmdLnOptionException - if an unexpected option is encountered during parsing.
throws:
  MissingCmdLnArgumentException - if a command line option does not have enough arguments during parsing.
since:
   ostermillerutils 1.07.00



printHelp
public void printHelp(OutputStream out, int indent, int width)(Code)
Print help for the command line options. Help will be in this format:
 program description
 --argument -a   argument a description
 --another -b       argument b description
 --third -c      argument c description
 
Parses the command line if not already parsed.
Parameters:
  out - destination to which the help is written.
Parameters:
  indent - the maximum number of characters to which all descriptions should be indented.
Parameters:
  width - the number of characters at which text should be wrapped.
throws:
  UnknownCmdLnOptionException - if an unexpected option is encountered during parsing.
throws:
  MissingCmdLnArgumentException - if a command line option does not have enough arguments during parsing.
since:
   ostermillerutils 1.07.00



printHelp
public void printHelp(Writer out, int indent, int width)(Code)
Print help for the command line options. Help will be in this format:
 program description
 --argument -a   argument a description
 --another -b       argument b description
 --third -c      argument c description
 
Parses the command line if not already parsed.
Parameters:
  out - destination to which the help is written.
Parameters:
  indent - the maximum number of characters to which all descriptions should be indented.
Parameters:
  width - the number of characters at which text should be wrapped.
throws:
  UnknownCmdLnOptionException - if an unexpected option is encountered during parsing.
throws:
  MissingCmdLnArgumentException - if a command line option does not have enough arguments during parsing.
since:
   ostermillerutils 1.07.00



printHelp
public void printHelp(PrintWriter out, int indent, int width)(Code)
Print help for the command line options. Help will be in this format:
 program description
 --argument -a   argument a description
 --another -b       argument b description
 --third -c      argument c description
 
Parses the command line if not already parsed.
Parameters:
  out - destination to which the help is written.
Parameters:
  indent - the maximum number of characters to which all descriptions should be indented.
Parameters:
  width - the number of characters at which text should be wrapped.
throws:
  UnknownCmdLnOptionException - if an unexpected option is encountered during parsing.
throws:
  MissingCmdLnArgumentException - if a command line option does not have enough arguments during parsing.
since:
   ostermillerutils 1.07.00



setDescription
public CmdLn setDescription(String description)(Code)
Set the description for the program. This description will be printed on the first line of the help message.
Parameters:
  description - short description about the program this for method chaining
since:
   ostermillerutils 1.07.00



setNonOptionSeparators
public CmdLn setNonOptionSeparators(String[] nonOptionSeparators)(Code)
Set the "stop" option that causes any following arguments to be treated as non-option arguments, even if they look like an option.

The default non-option separator is "--".
Parameters:
  nonOptionSeparators - List of arguments that stop processing options and treat remaining arguments as non option arguments. this for method chaining
since:
   ostermillerutils 1.07.00




setOptionArgumentDelimiters
public CmdLn setOptionArgumentDelimiters(char[] delimiters)(Code)
Set the delimiters that separate a option name from a value within a single argument. This is to support arguments of the form "--name=value". The equals sign can separate the option name ("name") from the option argument ("value"). By default, the delimiters are '=', ':', and ' '.
Parameters:
  delimiters - list of delimiters this for method chaining.
since:
   ostermillerutils 1.07.00



setOptionStarts
public CmdLn setOptionStarts(String longOptionsStart, String shortOptionsStart)(Code)
Set what long options and short options start with. Typically long options start with "--" and short options with "-" (this is the default).
Parameters:
  longOptionsStart - What long options start with (default "--") or null for no long options;
Parameters:
  shortOptionsStart - What short options start with (default "-") or null for no short options;
throws:
  IllegalArgumentException - if the long or short start is the empty string this for method chaining
since:
   ostermillerutils 1.07.00



setOptionStarts
public CmdLn setOptionStarts(String[] longOptionsStart, String[] shortOptionsStart)(Code)
Set what long options and short options start with. Typically long options start with "--" and short options with "-" and this is the default.

The first option start in each array will be the canonical option start that is used in the help message.
Parameters:
  longOptionsStart - What long options start with (default "--") or null or empty for no long options;
Parameters:
  shortOptionsStart - What short options start with (default "-") or null or empty for no short options;
throws:
  IllegalArgumentException - if the long or short start is the empty string this for method chaining
since:
   ostermillerutils 1.07.00




Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.