Class Format
java.lang.Object
java.text.Format
- All Implemented Interfaces:
Serializable, Cloneable
- Direct Known Subclasses:
DateFormat, MessageFormat, NumberFormat
The base of the formats that turn locale sensitive values into text and
back: DateFormat, NumberFormat and MessageFormat.
A subclass implements format(Object, StringBuffer, FieldPosition) and
parseObject(String, ParsePosition); the one-argument forms are written
over them, as in the JDK.
Differences from the JDK
- No
clonehere:Object.clone()answersnullon the device for anything but an array, so every format of this package declares aclonethat copies its own fields. - No
formatToCharacterIterator: the device has noAttributedCharacterIterator.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal StringFormats an object to text.abstract StringBufferformat(Object obj, StringBuffer toAppendTo, FieldPosition pos) Formats an object, appending the text totoAppendTo, and reports the range the fieldposnames took.parseObject(String source) Parses an object from the beginning ofsource.abstract ObjectparseObject(String source, ParsePosition pos) Parses an object fromsourcestarting atpos.
-
Constructor Details
-
Format
protected Format()
-
-
Method Details
-
format
-
format
Formats an object, appending the text to
toAppendTo, and reports the range the fieldposnames took.Throws
IllegalArgumentException: if this format cannot formatobj
-
parseObject
Parses an object fromsourcestarting atpos. On success the index ofposis moved past what was read; on failure it is left alone, the error index is set andnullis returned. -
parseObject
Parses an object from the beginning of
source.Throws
ParseException: if nothing at the beginning ofsourceparses
- Throws:
ParseException
-