Java Doc for Arguments.java in  » GIS » GeoTools-2.4.1 » org » geotools » resources » 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 » GIS » GeoTools 2.4.1 » org.geotools.resources 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.geotools.resources.Arguments

Arguments
public class Arguments (Code)
A helper class for parsing command-line arguments. Instance of this class are usually created inside main methods. For example:
 public static void main(String[] args) {
 Arguments arguments = new Arguments(args);
 }
 
Then, method likes Arguments.getRequiredString or Arguments.getOptionalString can be used. If a parameter is badly formatted or if a required parameter is not presents, then the method Arguments.illegalArgument will be invoked with a message that describes the error. The default implementation print the localized error message to standard output Arguments.out and exits the virtual machine with a call to System.exit with error code 1.
since:
   2.0
version:
   $Id: Arguments.java 27848 2007-11-12 13:10:32Z desruisseaux $
author:
   Martin Desruisseaux


Field Summary
final public  PrintWritererr
     Error stream to the console.
final public  Localelocale
     The locale.
final public  PrintWriterout
     Output stream to the console.

Constructor Summary
public  Arguments(String[] args)
     Construct a console.
Parameters:
  args - Command line arguments.

Method Summary
public  booleangetFlag(String name)
     Returns true if the specified flag is set on the command line. This method should be called exactly once for each flag.
public  BooleangetOptionalBoolean(String name)
     Returns an optional boolean value from the command line. The value, if defined, must be "true" or "false".
Parameters:
  name - The parameter name.
public  DoublegetOptionalDouble(String name)
     Returns an optional floating-point value from the command line.
public  IntegergetOptionalInteger(String name)
     Returns an optional integer value from the command line.
public  StringgetOptionalString(String name)
     Returns an optional string value from the command line.
public static  PrintWritergetPrintWriter(PrintStream out)
     Gets a print writer for the specified print stream.
public static  ReadergetReader(InputStream in)
     Gets a reader for the specified input stream.
public  String[]getRemainingArguments(int max)
     Returns the list of unprocessed arguments.
public  String[]getRemainingArguments(int max, char forbiddenPrefix)
     Returns the list of unprocessed arguments, which should not begin by the specified prefix.
public  booleangetRequiredBoolean(String name)
     Returns a required boolean value from the command line. The value must be "true" or "false".
Parameters:
  name - The parameter name.
public  doublegetRequiredDouble(String name)
     Returns a required floating-point value from the command line.
public  intgetRequiredInteger(String name)
     Returns a required integer value from the command line.
public  StringgetRequiredString(String name)
     Returns an required string value from the command line.
public static  WritergetWriter(OutputStream out)
     Gets a writer for the specified output stream.
protected  voidillegalArgument(Exception exception)
     Invoked when an the user has specified an illegal parameter.
public  voidprintSummary(Exception exception)
     Prints a summary of the specified exception, without stack trace.

Field Detail
err
final public PrintWriter err(Code)
Error stream to the console. This output stream will use encoding specified in the "-encoding" argument, if present. Otherwise, encoding will be fetch from user's preference.



locale
final public Locale locale(Code)
The locale. Locale will be fetch from the "-locale" argument, if present. Otherwise, the default locale will be used.



out
final public PrintWriter out(Code)
Output stream to the console. This output stream will use encoding specified in the "-encoding" argument, if present. Otherwise, encoding will be fetch from user's preference.




Constructor Detail
Arguments
public Arguments(String[] args)(Code)
Construct a console.
Parameters:
  args - Command line arguments. Arguments "-encoding" and "-locale" willbe automatically parsed.




Method Detail
getFlag
public boolean getFlag(String name)(Code)
Returns true if the specified flag is set on the command line. This method should be called exactly once for each flag. Second invocation for the same flag will returns false (unless the same flag appears many times on the command line).
Parameters:
  name - The flag name. true if this flag appears on the command line, or false otherwise.



getOptionalBoolean
public Boolean getOptionalBoolean(String name)(Code)
Returns an optional boolean value from the command line. The value, if defined, must be "true" or "false".
Parameters:
  name - The parameter name. Name are case-insensitive. The parameter value, of null if there is no parametergiven for the specified name.



getOptionalDouble
public Double getOptionalDouble(String name)(Code)
Returns an optional floating-point value from the command line. Numbers are parsed as of the Double.parseDouble(String) method, which means that the parsing is locale-insensitive. Locale insensitive parsing is required in order to use arguments in portable scripts.
Parameters:
  name - The parameter name. Name are case-insensitive. The parameter value, of null if there is no parametergiven for the specified name.



getOptionalInteger
public Integer getOptionalInteger(String name)(Code)
Returns an optional integer value from the command line. Numbers are parsed as of the Integer.parseInt(String) method, which means that the parsing is locale-insensitive. Locale insensitive parsing is required in order to use arguments in portable scripts.
Parameters:
  name - The parameter name. Name are case-insensitive. The parameter value, of null if there is no parametergiven for the specified name.



getOptionalString
public String getOptionalString(String name)(Code)
Returns an optional string value from the command line. This method should be called exactly once for each parameter. Second invocation for the same parameter will returns null , unless the same parameter appears many times on the command line.

Paramater may be instructions like "-encoding cp850" or "-encoding=cp850". Both forms (with or without "=") are accepted. Spaces around the '=' character, if any, are ignored.
Parameters:
  name - The parameter name (e.g. "-encoding"). Name are case-insensitive. The parameter value, of null if there is no parametergiven for the specified name.




getPrintWriter
public static PrintWriter getPrintWriter(PrintStream out)(Code)
Gets a print writer for the specified print stream. If the user specified an encoding in some previous run of Arguments , then this encoding will be used.
Parameters:
  out - The print stream to wrap. A PrintWriter wrapping the specified print stream with the user'sprefered encoding.



getReader
public static Reader getReader(InputStream in)(Code)
Gets a reader for the specified input stream. If the user specified an encoding in some previous run of Arguments , then this encoding will be used.
Parameters:
  in - The input stream to wrap. A Reader wrapping the specified input stream with the user'sprefered encoding.



getRemainingArguments
public String[] getRemainingArguments(int max)(Code)
Returns the list of unprocessed arguments. If the number of remaining arguments is greater than the specified maximum, then this method invokes Arguments.illegalArgument .
Parameters:
  max - Maximum remaining arguments autorized. An array of remaining arguments. Will never be longer than max .



getRemainingArguments
public String[] getRemainingArguments(int max, char forbiddenPrefix)(Code)
Returns the list of unprocessed arguments, which should not begin by the specified prefix. This method invokes (max) and verifies that none of the remaining arguments start with forbiddenPrefix . The forbidden prefix is usually '-' , the character used for options as in " -locale ", etc.
Parameters:
  max - Maximum remaining arguments autorized.
Parameters:
  forbiddenPrefix - The forbidden prefix, usually '-' . An array of remaining arguments. Will never be longer than max .
since:
   2.4



getRequiredBoolean
public boolean getRequiredBoolean(String name)(Code)
Returns a required boolean value from the command line. The value must be "true" or "false".
Parameters:
  name - The parameter name. Name are case-insensitive. The parameter value.



getRequiredDouble
public double getRequiredDouble(String name)(Code)
Returns a required floating-point value from the command line. Numbers are parsed as of the Double.parseDouble(String) method, which means that the parsing is locale-insensitive. Locale insensitive parsing is required in order to use arguments in portable scripts.
Parameters:
  name - The parameter name. Name are case-insensitive. The parameter value.



getRequiredInteger
public int getRequiredInteger(String name)(Code)
Returns a required integer value from the command line. Numbers are parsed as of the Integer.parseInt(String) method, which means that the parsing is locale-insensitive. Locale insensitive parsing is required in order to use arguments in portable scripts.
Parameters:
  name - The parameter name. Name are case-insensitive. The parameter value.



getRequiredString
public String getRequiredString(String name)(Code)
Returns an required string value from the command line. This method works like Arguments.getOptionalString , except that it will invokes Arguments.illegalArgument if the specified parameter was not given on the command line.
Parameters:
  name - The parameter name. Name are case-insensitive. The parameter value.



getWriter
public static Writer getWriter(OutputStream out)(Code)
Gets a writer for the specified output stream. If the user specified an encoding in some previous run of Arguments , then this encoding will be used.
Parameters:
  out - The output stream to wrap. A Writer wrapping the specified output stream with the user'sprefered encoding.



illegalArgument
protected void illegalArgument(Exception exception)(Code)
Invoked when an the user has specified an illegal parameter. The default implementation prints the localized error message to the standard output Arguments.out , and then exit the virtual machine. User may override this method if they want a different behavior.

This method is not invoked when an anormal error occured (for example an unexpected NullPointerException in some of developper's module). If such an error occurs, the normal exception mechanism will be used.
Parameters:
  exception - An exception with a message describing the user's error.




printSummary
public void printSummary(Exception exception)(Code)
Prints a summary of the specified exception, without stack trace. This method is invoked when a non-fatal (and somewhat expected) error occured, for example java.io.FileNotFoundException when the file were specified in argument.
Parameters:
  exception - An exception with a message describing the user's error.
since:
   2.3



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.