Formats an array of objects and appends the
MessageFormat
's pattern, with format elements replaced by the formatted objects, to the provided
StringBuffer
.
The text substituted for the individual format elements is derived from the current subformat of the format element and the arguments
element at the format element's argument index as indicated by the first matching line of the following table. An argument is unavailable if arguments
is null
or has fewer than argumentIndex+1 elements.
Subformat | Argument | Formatted Text |
any | unavailable | "{" + argumentIndex + "}" |
any | null | "null" |
instanceof ChoiceFormat | any | subformat.format(argument).indexOf('{') >= 0 ? (new MessageFormat(subformat.format(argument), getLocale())).format(argument) : subformat.format(argument) |
!= null | any | subformat.format(argument) |
null | instanceof Number | NumberFormat.getInstance(getLocale()).format(argument) |
null | instanceof Date | DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT, getLocale()).format(argument) |
null | instanceof String | argument |
null | any | argument.toString() |
If pos
is non-null, and refers to Field.ARGUMENT
, the location of the first formatted string will be returned.
@param arguments an array of objects to be formatted and substituted.
@param result where text is appended.
@param pos On input: an alignment field, if desired.On output: the offsets of the alignment field.
@exception IllegalArgumentException if an argument in thearguments
array is not of the type expected by the format element(s) that use it.