java.text
Class Format
java.lang.Object
|
+--java.text.Format
All Implemented Interfaces:
Serializable, Cloneable
This class is the abstract superclass of classes that format and parse
data to/from
Strings
. It is guaranteed that any
String
produced by a concrete subclass of
Format
will be parseable by that same subclass.
In addition to implementing the abstract methods in this class, subclasses
should provide static factory methods of the form
getInstance()
and getInstance(Locale)
if the
subclass loads different formatting/parsing schemes based on locale.
These subclasses should also implement a static method called
getAvailableLocales()
which returns an array of
available locales in the current runtime environment.
Authors:- Aaron M. Renn (arenn@urbanophile.com)
- Per Bothner <bothner@cygnus.com>
Format
public Format()
This method initializes a new instance of Format
.
It performs no actions, but acts as a default constructor for
subclasses.
clone
public Object clone()
Creates a copy of this object.
Returns:
format
public final String format(java.lang.Object obj)
This method formats an Object
into a String
.
Parameters:
Returns:
Throws:
format
public StringBuffer format(java.lang.Object obj, java.lang.StringBuffer sb, java.text.FieldPosition pos)
This method formats an Object
into a String
and
appends the String
to a StringBuffer
.
Parameters:
Returns:
- The updated
StringBuffer
.
Throws:
parseObject
public Object parseObject(java.lang.String str)
This method parses a String
and converts the parsed
contents into an Object
.
Parameters:
Returns:
Throws:
parseObject
public Object parseObject(java.lang.String str, java.text.ParsePosition pos)
This method parses a String
and converts the parsed
contents into an Object
.
Parameters:
Returns:
- The parsed
Object
, or null
in
case of error.
Strings
. It is guaranteed that anyString
produced by a concrete subclass ofFormat
will be parseable by that same subclass.In addition to implementing the abstract methods in this class, subclasses should provide static factory methods of the form
getInstance()
andgetInstance(Locale)
if the subclass loads different formatting/parsing schemes based on locale. These subclasses should also implement a static method calledgetAvailableLocales()
which returns an array of available locales in the current runtime environment.