public class BytesFormat extends Format
Bytes,
Long, Integer, or Short
based on the currently configured BytesDisplay
preference.Format.Field| Modifier and Type | Field and Description |
|---|---|
static String |
DETAILED_DECIMAL_FORMAT
The default format string using for decimal byte values.
|
| Constructor and Description |
|---|
BytesFormat()
Create an instance with default behavior.
|
BytesFormat(Format encapsulatedNumberFormat,
Format encapsulatedDecimalFormat)
Create an instance with the behavior that if the display preference is
BytesDisplay.Bytes, always use
encapsulatedNumberFormat; otherwise, use
encapsulatedDecimalFormat if the value is more than 1KB. |
| Modifier and Type | Method and Description |
|---|---|
StringBuffer |
format(Object obj,
StringBuffer toAppendTo,
FieldPosition pos)
If
obj is an instance of Bytes, long, integer or short, then
consider the bytes display preference when formatting the value. |
static BytesFormat |
getInstance()
Return a new instance of a BytesFormat with default options.
|
Object |
parseObject(String source,
ParsePosition pos)
Parses the input string according to the display mode.
|
clone, format, formatToCharacterIterator, parseObjectpublic static final String DETAILED_DECIMAL_FORMAT
public BytesFormat()
public BytesFormat(Format encapsulatedNumberFormat, Format encapsulatedDecimalFormat)
BytesDisplay.Bytes, always use
encapsulatedNumberFormat; otherwise, use
encapsulatedDecimalFormat if the value is more than 1KB.encapsulatedNumberFormat - the format for small sizesencapsulatedDecimalFormat - the format for larger sizespublic StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos)
obj is an instance of Bytes, long, integer or short, then
consider the bytes display preference when formatting the value.
Otherwise, format obj using the default formatter.public Object parseObject(String source, ParsePosition pos)
Bytes objectparseObject in class Formatpublic static BytesFormat getInstance()