java.text.Format
java.lang.Object
java.text.DateFormat, java.text.MessageFormat,
java.text.NumberFormat
java.lang.Cloneable, java.io.Serializable
New as of JDK 1.1
The Format class is an abstract class that is the superclass of all classes that handle locale-sensitive parsing and formatting of dates, numbers, and messages. The two format() methods take the information in a supplied object and convert it to a string. The two parseObject() methods do the reverse; they take the information from a string and construct an appropriate object.
public abstract class java.text.Format extends java.lang.Object implements java.io.Serializable, java.lang.Cloneable { // Instance Methods public Object clone(); public final String format(Object obj); public abstract StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos); public Object parseObject(String source); public abstract Object parseObject(String source, ParsePosition status); }
A copy of this Format.
Object.clone()
This method creates a copy of this Format and returns it.
The object to be formatted.
A string that contains a formatted representation of the object.
If the given object cannot be formatted.
This method formats the given object by calling format(Object, StringBuffer, FieldPosition) with an empty StringBuffer and a FieldPosition that has a value of 0.
public abstract StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos)
The object to be formatted.
A StringBuffer on which to append the formatted information.
A field.
The given buffer toAppendTo with the formatted representation of the object appended to it.
If the given object cannot be formatted.
This method formats the given object and appends the result to the given StringBuffer. After the object has been formatted, the beginning and ending indices of the given FieldPosition are updated to reflect the field's position in the formatted output.
A subclass of Format must implement this method.
The string to be parsed.
The object represented by the given string.
If the text cannot be parsed by this Format.
This method parses the given text and returns an appropriate object. It does this by calling parseObject(String, ParsePosition) with a ParsePosition that has an index of 0.
public abstract Object parseObject(String source, ParsePosition status)
The string to be parsed.
A ParsePosition object that specifies a position in the string.
The object represented by the text starting at the given position.
This method parses the given text, starting at the specified position, and returns an object created from the data. After the string has been parsed, the given ParsePosition object is updated so that its index is after the parsed text.
A subclass of Format must implement this method.
Method | Inherited From | Method | Inherited From |
---|---|---|---|
equals(Object) |
Object |
finalize() |
Object |
getClass() |
Object |
hashCode() |
Object |
notify() |
Object |
notifyAll() |
Object |
toString() |
Object |
wait() |
Object |
wait(long) |
Object |
wait(long, int) |
Object |
DateFormat, FieldPosition, MessageFormat, NumberFormat, ParseException, ParsePosition, String, StringBuffer
This HTML Help has been published using the chm2web software. |