Java Doc for HelpFormatter.java in  » Library » Apache-command-line » org » apache » commons » cli » 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 » Library » Apache command line » org.apache.commons.cli 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.apache.commons.cli.HelpFormatter

HelpFormatter
public class HelpFormatter (Code)
A formatter of help messages for the current command line options
author:
   Slawek Zachcial
author:
   John Keyes (john at integralsource.com)


Field Summary
final public static  StringDEFAULT_ARG_NAME
    
final public static  intDEFAULT_DESC_PAD
    
final public static  intDEFAULT_LEFT_PAD
    
final public static  StringDEFAULT_LONG_OPT_PREFIX
    
final public static  StringDEFAULT_OPT_PREFIX
    
final public static  StringDEFAULT_SYNTAX_PREFIX
    
final public static  intDEFAULT_WIDTH
    
public  StringdefaultArgName
    
public  intdefaultDescPad
    
public  intdefaultLeftPad
    
public  StringdefaultLongOptPrefix
    
public  StringdefaultNewLine
    
public  StringdefaultOptPrefix
    
public  StringdefaultSyntaxPrefix
    
public  intdefaultWidth
    


Method Summary
protected  StringcreatePadding(int len)
    

Return a String of padding of length len.


Parameters:
  len - The length of the String of padding to create.
protected  intfindWrapPos(String text, int width, int startPos)
     Finds the next text wrap position after startPos for the text in text with the column width width.
public  StringgetArgName()
     Returns the 'argName'.
public  intgetDescPadding()
     Returns the 'descPadding'.
public  intgetLeftPadding()
     Returns the 'leftPadding'.
public  StringgetLongOptPrefix()
     Returns the 'longOptPrefix'.
public  StringgetNewLine()
     Returns the 'newLine'.
public  StringgetOptPrefix()
     Returns the 'optPrefix'.
public  StringgetSyntaxPrefix()
     Returns the 'syntaxPrefix'.
public  intgetWidth()
     Returns the 'width'.
public  voidprintHelp(String cmdLineSyntax, Options options)
    

Print the help for options with the specified command line syntax.

public  voidprintHelp(String cmdLineSyntax, Options options, boolean autoUsage)
    

Print the help for options with the specified command line syntax.

public  voidprintHelp(String cmdLineSyntax, String header, Options options, String footer)
    

Print the help for options with the specified command line syntax.

public  voidprintHelp(String cmdLineSyntax, String header, Options options, String footer, boolean autoUsage)
    

Print the help for options with the specified command line syntax.

public  voidprintHelp(int width, String cmdLineSyntax, String header, Options options, String footer)
    

Print the help for options with the specified command line syntax.

public  voidprintHelp(int width, String cmdLineSyntax, String header, Options options, String footer, boolean autoUsage)
    

Print the help for options with the specified command line syntax.

public  voidprintHelp(PrintWriter pw, int width, String cmdLineSyntax, String header, Options options, int leftPad, int descPad, String footer)
    
public  voidprintHelp(PrintWriter pw, int width, String cmdLineSyntax, String header, Options options, int leftPad, int descPad, String footer, boolean autoUsage)
    
public  voidprintOptions(PrintWriter pw, int width, Options options, int leftPad, int descPad)
    
public  voidprintUsage(PrintWriter pw, int width, String app, Options options)
    
public  voidprintUsage(PrintWriter pw, int width, String cmdLineSyntax)
    
public  voidprintWrapped(PrintWriter pw, int width, String text)
    
public  voidprintWrapped(PrintWriter pw, int width, int nextLineTabStop, String text)
    
protected  StringBufferrenderOptions(StringBuffer sb, int width, Options options, int leftPad, int descPad)
    
protected  StringBufferrenderWrappedText(StringBuffer sb, int width, int nextLineTabStop, String text)
    

Render the specified text and return the rendered Options in a StringBuffer.


Parameters:
  sb - The StringBuffer to place the rendered text into.
Parameters:
  width - The number of characters to display per line
Parameters:
  nextLineTabStop - The position on the next line for the first tab.
Parameters:
  text - The text to be rendered.
protected  Stringrtrim(String s)
    

Remove the trailing whitespace from the specified String.


Parameters:
  s - The String to remove the trailing padding from.
public  voidsetArgName(String name)
     Sets the 'argName'.
public  voidsetDescPadding(int padding)
     Sets the 'descPadding'.
public  voidsetLeftPadding(int padding)
     Sets the 'leftPadding'.
public  voidsetLongOptPrefix(String prefix)
     Sets the 'longOptPrefix'.
public  voidsetNewLine(String newline)
     Sets the 'newLine'.
public  voidsetOptPrefix(String prefix)
     Sets the 'optPrefix'.
public  voidsetSyntaxPrefix(String prefix)
     Sets the 'syntaxPrefix'.
public  voidsetWidth(int width)
     Sets the 'width'.

Field Detail
DEFAULT_ARG_NAME
final public static String DEFAULT_ARG_NAME(Code)
default name for an argument



DEFAULT_DESC_PAD
final public static int DEFAULT_DESC_PAD(Code)
the number of characters of padding to be prefixed to each description line



DEFAULT_LEFT_PAD
final public static int DEFAULT_LEFT_PAD(Code)
default padding to the left of each line



DEFAULT_LONG_OPT_PREFIX
final public static String DEFAULT_LONG_OPT_PREFIX(Code)
default prefix for long Option



DEFAULT_OPT_PREFIX
final public static String DEFAULT_OPT_PREFIX(Code)
default prefix for shortOpts



DEFAULT_SYNTAX_PREFIX
final public static String DEFAULT_SYNTAX_PREFIX(Code)
the string to display at the begining of the usage statement



DEFAULT_WIDTH
final public static int DEFAULT_WIDTH(Code)
default number of characters per line



defaultArgName
public String defaultArgName(Code)
the name of the argument



defaultDescPad
public int defaultDescPad(Code)
the number of characters of padding to be prefixed to each description line



defaultLeftPad
public int defaultLeftPad(Code)
amount of padding to the left of each line



defaultLongOptPrefix
public String defaultLongOptPrefix(Code)
the long Opt prefix



defaultNewLine
public String defaultNewLine(Code)
the new line string



defaultOptPrefix
public String defaultOptPrefix(Code)
the shortOpt prefix



defaultSyntaxPrefix
public String defaultSyntaxPrefix(Code)
the string to display at the begining of the usage statement



defaultWidth
public int defaultWidth(Code)
number of characters per line





Method Detail
createPadding
protected String createPadding(int len)(Code)

Return a String of padding of length len.


Parameters:
  len - The length of the String of padding to create. The String of padding



findWrapPos
protected int findWrapPos(String text, int width, int startPos)(Code)
Finds the next text wrap position after startPos for the text in text with the column width width. The wrap point is the last postion before startPos+width having a whitespace character (space, \n, \r).
Parameters:
  text - The text being searched for the wrap position
Parameters:
  width - width of the wrapped text
Parameters:
  startPos - position from which to start the lookup whitespace character postion on which the text must be wrapped or -1 if the wrap position is at the end of the text



getArgName
public String getArgName()(Code)
Returns the 'argName'. the 'argName'



getDescPadding
public int getDescPadding()(Code)
Returns the 'descPadding'. the 'descPadding'



getLeftPadding
public int getLeftPadding()(Code)
Returns the 'leftPadding'. the 'leftPadding'



getLongOptPrefix
public String getLongOptPrefix()(Code)
Returns the 'longOptPrefix'. the 'longOptPrefix'



getNewLine
public String getNewLine()(Code)
Returns the 'newLine'. the 'newLine'



getOptPrefix
public String getOptPrefix()(Code)
Returns the 'optPrefix'. the 'optPrefix'



getSyntaxPrefix
public String getSyntaxPrefix()(Code)
Returns the 'syntaxPrefix'. the 'syntaxPrefix'



getWidth
public int getWidth()(Code)
Returns the 'width'. the 'width'



printHelp
public void printHelp(String cmdLineSyntax, Options options)(Code)

Print the help for options with the specified command line syntax. This method prints help information to System.out.


Parameters:
  cmdLineSyntax - the syntax for this application
Parameters:
  options - the Options instance



printHelp
public void printHelp(String cmdLineSyntax, Options options, boolean autoUsage)(Code)

Print the help for options with the specified command line syntax. This method prints help information to System.out.


Parameters:
  cmdLineSyntax - the syntax for this application
Parameters:
  options - the Options instance
Parameters:
  autoUsage - whether to print an automatically generated usage statement



printHelp
public void printHelp(String cmdLineSyntax, String header, Options options, String footer)(Code)

Print the help for options with the specified command line syntax. This method prints help information to System.out.


Parameters:
  cmdLineSyntax - the syntax for this application
Parameters:
  header - the banner to display at the begining of the help
Parameters:
  options - the Options instance
Parameters:
  footer - the banner to display at the end of the help



printHelp
public void printHelp(String cmdLineSyntax, String header, Options options, String footer, boolean autoUsage)(Code)

Print the help for options with the specified command line syntax. This method prints help information to System.out.


Parameters:
  cmdLineSyntax - the syntax for this application
Parameters:
  header - the banner to display at the begining of the help
Parameters:
  options - the Options instance
Parameters:
  footer - the banner to display at the end of the help
Parameters:
  autoUsage - whether to print an automatically generated usage statement



printHelp
public void printHelp(int width, String cmdLineSyntax, String header, Options options, String footer)(Code)

Print the help for options with the specified command line syntax. This method prints help information to System.out.


Parameters:
  width - the number of characters to be displayed on each line
Parameters:
  cmdLineSyntax - the syntax for this application
Parameters:
  header - the banner to display at the begining of the help
Parameters:
  options - the Options instance
Parameters:
  footer - the banner to display at the end of the help



printHelp
public void printHelp(int width, String cmdLineSyntax, String header, Options options, String footer, boolean autoUsage)(Code)

Print the help for options with the specified command line syntax. This method prints help information to System.out.


Parameters:
  width - the number of characters to be displayed on each line
Parameters:
  cmdLineSyntax - the syntax for this application
Parameters:
  header - the banner to display at the begining of the help
Parameters:
  options - the Options instance
Parameters:
  footer - the banner to display at the end of the help
Parameters:
  autoUsage - whether to print an automatically generated usage statement



printHelp
public void printHelp(PrintWriter pw, int width, String cmdLineSyntax, String header, Options options, int leftPad, int descPad, String footer)(Code)

Print the help for options with the specified command line syntax.


Parameters:
  pw - the writer to which the help will be written
Parameters:
  width - the number of characters to be displayed on each line
Parameters:
  cmdLineSyntax - the syntax for this application
Parameters:
  header - the banner to display at the begining of the help
Parameters:
  options - the Options instance
Parameters:
  leftPad - the number of characters of padding to be prefixedto each line
Parameters:
  descPad - the number of characters of padding to be prefixedto each description line
Parameters:
  footer - the banner to display at the end of the help



printHelp
public void printHelp(PrintWriter pw, int width, String cmdLineSyntax, String header, Options options, int leftPad, int descPad, String footer, boolean autoUsage)(Code)

Print the help for options with the specified command line syntax.


Parameters:
  pw - the writer to which the help will be written
Parameters:
  width - the number of characters to be displayed on each line
Parameters:
  cmdLineSyntax - the syntax for this application
Parameters:
  header - the banner to display at the begining of the help
Parameters:
  options - the Options instance
Parameters:
  leftPad - the number of characters of padding to be prefixedto each line
Parameters:
  descPad - the number of characters of padding to be prefixedto each description line
Parameters:
  footer - the banner to display at the end of the help
Parameters:
  autoUsage - whether to print an automatically generated usage statement



printOptions
public void printOptions(PrintWriter pw, int width, Options options, int leftPad, int descPad)(Code)

Print the help for the specified Options to the specified writer, using the specified width, left padding and description padding.


Parameters:
  pw - The printWriter to write the help to
Parameters:
  width - The number of characters to display per line
Parameters:
  options - The command line Options
Parameters:
  leftPad - the number of characters of padding to be prefixedto each line
Parameters:
  descPad - the number of characters of padding to be prefixedto each description line



printUsage
public void printUsage(PrintWriter pw, int width, String app, Options options)(Code)

Prints the usage statement for the specified application.


Parameters:
  pw - The PrintWriter to print the usage statement
Parameters:
  width - The number of characters to display per line
Parameters:
  app - The application name
Parameters:
  options - The command line Options



printUsage
public void printUsage(PrintWriter pw, int width, String cmdLineSyntax)(Code)

Print the cmdLineSyntax to the specified writer, using the specified width.


Parameters:
  pw - The printWriter to write the help to
Parameters:
  width - The number of characters per line for the usage statement.
Parameters:
  cmdLineSyntax - The usage statement.



printWrapped
public void printWrapped(PrintWriter pw, int width, String text)(Code)

Print the specified text to the specified PrintWriter.


Parameters:
  pw - The printWriter to write the help to
Parameters:
  width - The number of characters to display per line
Parameters:
  text - The text to be written to the PrintWriter



printWrapped
public void printWrapped(PrintWriter pw, int width, int nextLineTabStop, String text)(Code)

Print the specified text to the specified PrintWriter.


Parameters:
  pw - The printWriter to write the help to
Parameters:
  width - The number of characters to display per line
Parameters:
  nextLineTabStop - The position on the next line for the first tab.
Parameters:
  text - The text to be written to the PrintWriter



renderOptions
protected StringBuffer renderOptions(StringBuffer sb, int width, Options options, int leftPad, int descPad)(Code)

Render the specified Options and return the rendered Options in a StringBuffer.


Parameters:
  sb - The StringBuffer to place the rendered Options into.
Parameters:
  width - The number of characters to display per line
Parameters:
  options - The command line Options
Parameters:
  leftPad - the number of characters of padding to be prefixedto each line
Parameters:
  descPad - the number of characters of padding to be prefixedto each description line the StringBuffer with the rendered Options contents.



renderWrappedText
protected StringBuffer renderWrappedText(StringBuffer sb, int width, int nextLineTabStop, String text)(Code)

Render the specified text and return the rendered Options in a StringBuffer.


Parameters:
  sb - The StringBuffer to place the rendered text into.
Parameters:
  width - The number of characters to display per line
Parameters:
  nextLineTabStop - The position on the next line for the first tab.
Parameters:
  text - The text to be rendered. the StringBuffer with the rendered Options contents.



rtrim
protected String rtrim(String s)(Code)

Remove the trailing whitespace from the specified String.


Parameters:
  s - The String to remove the trailing padding from. The String of without the trailing padding



setArgName
public void setArgName(String name)(Code)
Sets the 'argName'.
Parameters:
  name - the new value of 'argName'



setDescPadding
public void setDescPadding(int padding)(Code)
Sets the 'descPadding'.
Parameters:
  padding - the new value of 'descPadding'



setLeftPadding
public void setLeftPadding(int padding)(Code)
Sets the 'leftPadding'.
Parameters:
  padding - the new value of 'leftPadding'



setLongOptPrefix
public void setLongOptPrefix(String prefix)(Code)
Sets the 'longOptPrefix'.
Parameters:
  prefix - the new value of 'longOptPrefix'



setNewLine
public void setNewLine(String newline)(Code)
Sets the 'newLine'.
Parameters:
  newline - the new value of 'newLine'



setOptPrefix
public void setOptPrefix(String prefix)(Code)
Sets the 'optPrefix'.
Parameters:
  prefix - the new value of 'optPrefix'



setSyntaxPrefix
public void setSyntaxPrefix(String prefix)(Code)
Sets the 'syntaxPrefix'.
Parameters:
  prefix - the new value of 'syntaxPrefix'



setWidth
public void setWidth(int width)(Code)
Sets the 'width'.
Parameters:
  width - the new value of 'width'



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.