Java Doc for NumberFormat.java in  » Apache-Harmony-Java-SE » java-package » java » text » 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 » Apache Harmony Java SE » java package » java.text 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   java.text.Format
      java.text.NumberFormat

NumberFormat
abstract public class NumberFormat extends Format (Code)
NumberFormat is the abstract superclass of Formats which format and parse Numbers.

Inner Class :public static class Field extends Format.Field

Field Summary
final public static  intFRACTION_FIELD
     Field constant.
final public static  intINTEGER_FIELD
     Field constant.

Constructor Summary
public  NumberFormat()
     Constructs a new instance of DateFormat.

Method Summary
public  Objectclone()
     Answers a new NumberFormat with the same properties as this NumberFormat.
public  booleanequals(Object object)
     Compares the specified object to this NumberFormat and answer if they are equal.
final public  Stringformat(double value)
     Formats the specified double using the rules of this NumberFormat.
abstract public  StringBufferformat(double value, StringBuffer buffer, FieldPosition field)
     Formats the double value into the specified StringBuffer using the rules of this NumberFormat.
final public  Stringformat(long value)
     Formats the specified long using the rules of this NumberFormat.
abstract public  StringBufferformat(long value, StringBuffer buffer, FieldPosition field)
     Formats the long value into the specified StringBuffer using the rules of this NumberFormat.
public  StringBufferformat(Object object, StringBuffer buffer, FieldPosition field)
     Formats the specified object into the specified StringBuffer using the rules of this DateFormat.
public static  Locale[]getAvailableLocales()
     Gets the list of installed Locales which support NumberFormat.
public  CurrencygetCurrency()
     Answers the currency used by this number format

This implementation throws UnsupportedOperationException, concrete sub classes should override if they support currency formatting.

final public static  NumberFormatgetCurrencyInstance()
     Answers a NumberFormat for formatting and parsing currency for the default Locale.
public static  NumberFormatgetCurrencyInstance(Locale locale)
     Answers a NumberFormat for formatting and parsing currency for the specified Locale.
final public static  NumberFormatgetInstance()
     Answers a NumberFormat for formatting and parsing numbers for the default Locale.
public static  NumberFormatgetInstance(Locale locale)
     Answers a NumberFormat for formatting and parsing numbers for the specified Locale.
final public static  NumberFormatgetIntegerInstance()
     Answers a NumberFormat for formatting and parsing integers for the default Locale.
public static  NumberFormatgetIntegerInstance(Locale locale)
     Answers a NumberFormat for formatting and parsing integers for the specified Locale.
public  intgetMaximumFractionDigits()
     Answers the maximum number of fraction digits that are printed when formatting.
public  intgetMaximumIntegerDigits()
     Answers the maximum number of integer digits that are printed when formatting.
public  intgetMinimumFractionDigits()
     Answers the minimum number of fraction digits that are printed when formatting.
public  intgetMinimumIntegerDigits()
     Answers the minimum number of integer digits that are printed when formatting.
final public static  NumberFormatgetNumberInstance()
     Answers a NumberFormat for formatting and parsing numbers for the default Locale.
public static  NumberFormatgetNumberInstance(Locale locale)
     Answers a NumberFormat for formatting and parsing numbers for the specified Locale.
final public static  NumberFormatgetPercentInstance()
     Answers a NumberFormat for formatting and parsing percentages for the default Locale.
public static  NumberFormatgetPercentInstance(Locale locale)
     Answers a NumberFormat for formatting and parsing percentages for the specified Locale.
public  inthashCode()
     Answers an integer hash code for the receiver.
public  booleanisGroupingUsed()
     Answers whether this NumberFormat formats and parses numbers using a grouping separator.
public  booleanisParseIntegerOnly()
     Answers whether this NumberFormat only parses integer numbers.
public  Numberparse(String string)
     Parse a Number from the specified String using the rules of this NumberFormat.
abstract public  Numberparse(String string, ParsePosition position)
     Parse a Number from the specified String starting at the index specified by the ParsePosition.
final public  ObjectparseObject(String string, ParsePosition position)
     Parse a Number from the specified String starting at the index specified by the ParsePosition.
public  voidsetCurrency(Currency currency)
     Sets the currency used by this number format when formatting currency values.
public  voidsetGroupingUsed(boolean value)
     Sets whether this NumberFormat formats and parses numbers using a grouping separator.
public  voidsetMaximumFractionDigits(int value)
     Sets the maximum number of fraction digits that are printed when formatting.
public  voidsetMaximumIntegerDigits(int value)
     Used to specify the new maximum count of integer digits that are printed when formatting.
public  voidsetMinimumFractionDigits(int value)
     Sets the minimum number of fraction digits that are printed when formatting.
public  voidsetMinimumIntegerDigits(int value)
     Sets the minimum number of integer digits that are printed when formatting.
public  voidsetParseIntegerOnly(boolean value)
     Specifies if this NumberFormat should only parse numbers as integers or else as any kind of number.

Field Detail
FRACTION_FIELD
final public static int FRACTION_FIELD(Code)
Field constant.



INTEGER_FIELD
final public static int INTEGER_FIELD(Code)
Field constant.




Constructor Detail
NumberFormat
public NumberFormat()(Code)
Constructs a new instance of DateFormat.




Method Detail
clone
public Object clone()(Code)
Answers a new NumberFormat with the same properties as this NumberFormat. a shallow copy of this NumberFormat
See Also:   java.lang.Cloneable



equals
public boolean equals(Object object)(Code)
Compares the specified object to this NumberFormat and answer if they are equal. The object must be an instance of NumberFormat and have the same properties.
Parameters:
  object - the object to compare with this object true if the specified object is equal to this NumberFormat, falseotherwise
See Also:   NumberFormat.hashCode



format
final public String format(double value)(Code)
Formats the specified double using the rules of this NumberFormat.
Parameters:
  value - the double to format the formatted String



format
abstract public StringBuffer format(double value, StringBuffer buffer, FieldPosition field)(Code)
Formats the double value into the specified StringBuffer using the rules of this NumberFormat. If the field specified by the FieldPosition is formatted, set the begin and end index of the formatted field in the FieldPosition.
Parameters:
  value - the double to format
Parameters:
  buffer - the StringBuffer
Parameters:
  field - the FieldPosition the StringBuffer parameter buffer



format
final public String format(long value)(Code)
Formats the specified long using the rules of this NumberFormat.
Parameters:
  value - the long to format the formatted String



format
abstract public StringBuffer format(long value, StringBuffer buffer, FieldPosition field)(Code)
Formats the long value into the specified StringBuffer using the rules of this NumberFormat. If the field specified by the FieldPosition is formatted, set the begin and end index of the formatted field in the FieldPosition.
Parameters:
  value - the long to format
Parameters:
  buffer - the StringBuffer
Parameters:
  field - the FieldPosition the StringBuffer parameter buffer



format
public StringBuffer format(Object object, StringBuffer buffer, FieldPosition field)(Code)
Formats the specified object into the specified StringBuffer using the rules of this DateFormat. If the field specified by the FieldPosition is formatted, set the begin and end index of the formatted field in the FieldPosition.
Parameters:
  object - the object to format, must be a Number
Parameters:
  buffer - the StringBuffer
Parameters:
  field - the FieldPosition the StringBuffer parameter buffer
exception:
  IllegalArgumentException - when the object is not a Number



getAvailableLocales
public static Locale[] getAvailableLocales()(Code)
Gets the list of installed Locales which support NumberFormat. an array of Locale



getCurrency
public Currency getCurrency()(Code)
Answers the currency used by this number format

This implementation throws UnsupportedOperationException, concrete sub classes should override if they support currency formatting.

currency currency that was set in getInstance() or insetCurrency(), or null
throws:
  java.lang.UnsupportedOperationException -




getCurrencyInstance
final public static NumberFormat getCurrencyInstance()(Code)
Answers a NumberFormat for formatting and parsing currency for the default Locale. a NumberFormat



getCurrencyInstance
public static NumberFormat getCurrencyInstance(Locale locale)(Code)
Answers a NumberFormat for formatting and parsing currency for the specified Locale.
Parameters:
  locale - the Locale a NumberFormat



getInstance
final public static NumberFormat getInstance()(Code)
Answers a NumberFormat for formatting and parsing numbers for the default Locale. a NumberFormat



getInstance
public static NumberFormat getInstance(Locale locale)(Code)
Answers a NumberFormat for formatting and parsing numbers for the specified Locale.
Parameters:
  locale - the Locale a NumberFormat



getIntegerInstance
final public static NumberFormat getIntegerInstance()(Code)
Answers a NumberFormat for formatting and parsing integers for the default Locale. a NumberFormat



getIntegerInstance
public static NumberFormat getIntegerInstance(Locale locale)(Code)
Answers a NumberFormat for formatting and parsing integers for the specified Locale.
Parameters:
  locale - the Locale a NumberFormat



getMaximumFractionDigits
public int getMaximumFractionDigits()(Code)
Answers the maximum number of fraction digits that are printed when formatting. If the maximum is less than the number of fraction digits, the least significant digits are truncated. the maximum number of fraction digits



getMaximumIntegerDigits
public int getMaximumIntegerDigits()(Code)
Answers the maximum number of integer digits that are printed when formatting. If the maximum is less than the number of integer digits, the most significant digits are truncated. the maximum number of integer digits



getMinimumFractionDigits
public int getMinimumFractionDigits()(Code)
Answers the minimum number of fraction digits that are printed when formatting. the minimum number of fraction digits



getMinimumIntegerDigits
public int getMinimumIntegerDigits()(Code)
Answers the minimum number of integer digits that are printed when formatting. the minimum number of integer digits



getNumberInstance
final public static NumberFormat getNumberInstance()(Code)
Answers a NumberFormat for formatting and parsing numbers for the default Locale. a NumberFormat



getNumberInstance
public static NumberFormat getNumberInstance(Locale locale)(Code)
Answers a NumberFormat for formatting and parsing numbers for the specified Locale.
Parameters:
  locale - the Locale a NumberFormat



getPercentInstance
final public static NumberFormat getPercentInstance()(Code)
Answers a NumberFormat for formatting and parsing percentages for the default Locale. a NumberFormat



getPercentInstance
public static NumberFormat getPercentInstance(Locale locale)(Code)
Answers a NumberFormat for formatting and parsing percentages for the specified Locale.
Parameters:
  locale - the Locale a NumberFormat



hashCode
public int hashCode()(Code)
Answers an integer hash code for the receiver. Objects which are equal answer the same value for this method. the receiver's hash
See Also:   NumberFormat.equals



isGroupingUsed
public boolean isGroupingUsed()(Code)
Answers whether this NumberFormat formats and parses numbers using a grouping separator. true when a grouping separator is used, false otherwise



isParseIntegerOnly
public boolean isParseIntegerOnly()(Code)
Answers whether this NumberFormat only parses integer numbers. Parsing stops if a decimal separator is encountered. true if this NumberFormat only parses integers, false for parsingintegers or fractions



parse
public Number parse(String string) throws ParseException(Code)
Parse a Number from the specified String using the rules of this NumberFormat.
Parameters:
  string - the String to parse the Number resulting from the parse
exception:
  ParseException - when an error occurs during parsing



parse
abstract public Number parse(String string, ParsePosition position)(Code)
Parse a Number from the specified String starting at the index specified by the ParsePosition. If the string is successfully parsed, the index of the ParsePosition is updated to the index following the parsed text.
Parameters:
  string - the String to parse
Parameters:
  position - the ParsePosition, updated on return with the index followingthe parsed text, or on error the index is unchanged and theerror index is set to the index where the error occurred the Number resulting from the parse, or null if there is an error



parseObject
final public Object parseObject(String string, ParsePosition position)(Code)
Parse a Number from the specified String starting at the index specified by the ParsePosition. If the string is successfully parsed, the index of the ParsePosition is updated to the index following the parsed text.
Parameters:
  string - the String to parse
Parameters:
  position - the ParsePosition, updated on return with the index followingthe parsed text, or on error the index is unchanged and theerror index is set to the index where the error occurred the Number resulting from the parse, or null if there is an error



setCurrency
public void setCurrency(Currency currency)(Code)
Sets the currency used by this number format when formatting currency values.

The min and max fraction digits remain the same.

This implementation throws UnsupportedOperationException, concrete sub classes should override if they support currency formatting.


Parameters:
  currency - the new Currency
throws:
  java.lang.UnsupportedOperationException -




setGroupingUsed
public void setGroupingUsed(boolean value)(Code)
Sets whether this NumberFormat formats and parses numbers using a grouping separator.
Parameters:
  value - true when a grouping separator is used, false otherwise



setMaximumFractionDigits
public void setMaximumFractionDigits(int value)(Code)
Sets the maximum number of fraction digits that are printed when formatting. If the maximum is less than the number of fraction digits, the least significant digits are truncated.
Parameters:
  value - the maximum number of fraction digits



setMaximumIntegerDigits
public void setMaximumIntegerDigits(int value)(Code)
Used to specify the new maximum count of integer digits that are printed when formatting. If the maximum is less than the number of integer digits, the most significant digits are truncated.
Parameters:
  value - the new maximum number of integer numerals for display



setMinimumFractionDigits
public void setMinimumFractionDigits(int value)(Code)
Sets the minimum number of fraction digits that are printed when formatting.
Parameters:
  value - the minimum number of fraction digits



setMinimumIntegerDigits
public void setMinimumIntegerDigits(int value)(Code)
Sets the minimum number of integer digits that are printed when formatting.
Parameters:
  value - the minimum number of integer digits



setParseIntegerOnly
public void setParseIntegerOnly(boolean value)(Code)
Specifies if this NumberFormat should only parse numbers as integers or else as any kind of number. If this is called with a true value then subsequent parsing attempts will stop if a decimal separator is encountered.
Parameters:
  value - true to only parse integers, falseto parse integers and fractions



Methods inherited from java.text.Format
public Object clone()(Code)(Java Doc)
String convertPattern(String template, String fromChars, String toChars, boolean check)(Code)(Java Doc)
final public String format(Object object)(Code)(Java Doc)
abstract public StringBuffer format(Object object, StringBuffer buffer, FieldPosition field)(Code)(Java Doc)
public AttributedCharacterIterator formatToCharacterIterator(Object object)(Code)(Java Doc)
static Object getInternalField(String fieldName, Object target)(Code)(Java Doc)
public Object parseObject(String string) throws ParseException(Code)(Java Doc)
abstract public Object parseObject(String string, ParsePosition position)(Code)(Java Doc)
static boolean upTo(String string, ParsePosition position, StringBuffer buffer, char stop)(Code)(Java Doc)
static boolean upToWithQuotes(String string, ParsePosition position, StringBuffer buffer, char stop, char start)(Code)(Java Doc)

Methods inherited from java.lang.Object
protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object object)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final public Class<? extends Object> getClass()(Code)(Java Doc)
public int hashCode()(Code)(Java Doc)
final public void notify()(Code)(Java Doc)
final public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final public void wait(long millis, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait(long millis) 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.