| java.util.Formattable
Formattable | public interface Formattable (Code) | | Any class that need to perform customer formatting by transferring converter
specifier 's' to Formatter should implement the Formattable interface. Basic
format is allowed by the interface to format arbitrary objects.
|
Method Summary | |
void | formatTo(Formatter formatter, int flags, int width, int precision) Formats the object using the specified formatter.
Parameters: formatter - The formatter to use in the formatTo. Parameters: flags - The flags applied to the output format, which is a bitmaskthat is any combination of FormattableFlags.LEFT_JUSTIFY,FormattableFlags.UPPERCASE, and FormattableFlags.ALTERNATE. |
formatTo | void formatTo(Formatter formatter, int flags, int width, int precision) throws IllegalFormatException(Code) | | Formats the object using the specified formatter.
Parameters: formatter - The formatter to use in the formatTo. Parameters: flags - The flags applied to the output format, which is a bitmaskthat is any combination of FormattableFlags.LEFT_JUSTIFY,FormattableFlags.UPPERCASE, and FormattableFlags.ALTERNATE. Ifno such flag is set, the output is formatted by the defaultformatting of the implementation of the interface. Parameters: width - The minimum number of characters that should be written to theoutput. Additional space ' ' is added to the output if thelength of the converted value is less than the width until thelength equals the width. These spaces are added at thebeginning by default unless the flagFormattableFlags.LEFT_JUSTIFY is set, which denotes thatpadding should be added at the end. If width is -1, then nominimum requirement. Parameters: precision - The maximum number of characters that can be written to theoutput. The procedure to trunk the output according to theprecision is invoked before that of padding to width. If theprecision is -1, then no maximum requirement. throws: IllegalFormatException - If any of the parameters is not supported. |
|
|