Format.format

Format.format

Class Overview | Class Members | This Package | All Packages

Syntax 1
public final String format( Object obj )
Parameters
obj
The object to format
Returns
Formatted string.
Description
Formats an object to produce a string.

Subclasses will override the StringBuffer version of format.

Exceptions
IllegalArgumentException when the Format cannot format the type of object.
See Also
MessageFormat, format



Syntax 2
public abstract StringBuffer format( Object obj, StringBuffer toAppendTo, FieldPosition pos )
Parameters
obj
The object to format
toAppendTo
where the text is to be appended
status
On input: an alignment field, if desired. On output: the offsets of the alignment field.
Returns
the value passed in as toAppendTo (this allows chaining, as with StringBuffer.append())
Description
Formats an object to produce a string. Subclasses will implement for particular object, such as:
 StringBuffer format (Number obj, StringBuffer toAppendTo)
 Number parse (String str)
 
These general routines allow polymorphic parsing and formatting for objects such as the MessageFormat.

Exceptions
IllegalArgumentException when the Format cannot format the given object.
See Also
MessageFormat, FieldPosition