Android
java.text
public abstract class

java.text.Format

java.lang.Object
java.text.Format Serializable Cloneable

Format is the abstract superclass of classes which format and parse objects according to Locale specific rules.

Nested Classes
Format.Field This inner class is used to represent Format attributes in the AttributedCharacterIterator that formatToCharacterIterator() method returns in the Format subclasses. 
Known Direct Subclasses
Known Indirect Subclasses

Summary

Public Constructors

            Format()
Constructs a new instance of Format.

Public Methods

          Object  clone()
Returns a copy of this Format.
abstract          StringBuffer  format(Object object, StringBuffer buffer, FieldPosition field)
Formats the specified object into the specified StringBuffer using the rules of this Format.
    final      String  format(Object object)
Formats the specified object using the rules of this Format.
          AttributedCharacterIterator  formatToCharacterIterator(Object object)
Formats the specified object using the rules of this format and returns an AttributedCharacterIterator with the formatted String and no attributes.
abstract          Object  parseObject(String string, ParsePosition position)
Parse the specified String starting at the index specified by the ParsePosition.
          Object  parseObject(String string)
Parse the specified String using the rules of this Format.
Methods inherited from class java.lang.Object

Details

Public Constructors

public Format()

Constructs a new instance of Format.

Public Methods

public Object clone()

Returns a copy of this Format.

Returns

  • a shallow copy of this Format

See Also

public abstract StringBuffer format(Object object, StringBuffer buffer, FieldPosition field)

Formats the specified object into the specified StringBuffer using the rules of this Format. 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
buffer the StringBuffer
field the FieldPosition

Returns

  • the StringBuffer parameter buffer

Throws

IllegalArgumentException when the object cannot be formatted by this Format

public final String format(Object object)

Formats the specified object using the rules of this Format.

Parameters

object the object to format

Returns

  • the formatted String

Throws

IllegalArgumentException when the object cannot be formatted by this Format

public AttributedCharacterIterator formatToCharacterIterator(Object object)

Formats the specified object using the rules of this format and returns an AttributedCharacterIterator with the formatted String and no attributes.

Subclasses should return an AttributedCharacterIterator with the appropriate attributes.

Parameters

object the object to format

Returns

  • an AttributedCharacterIterator with the formatted object and attributes

Throws

IllegalArgumentException when the object cannot be formatted by this Format

public abstract Object parseObject(String string, ParsePosition position)

Parse 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
position the ParsePosition, updated on return with the index following the parsed text, or on error the index is unchanged and the error index is set to the index where the error occurred

Returns

  • the object resulting from the parse, or null if there is an error

public Object parseObject(String string)

Parse the specified String using the rules of this Format.

Parameters

string the String to parse

Returns

  • the object resulting from the parse

Throws

ParseException when an error occurs during parsing
Copyright 2007 Google Inc. Build 0.9_r1-98467 - 14 Aug 2008 18:56