org.eclipse.mat.query
Class BytesFormat
java.lang.Object
java.text.Format
org.eclipse.mat.query.BytesFormat
- All Implemented Interfaces:
- Serializable, Cloneable
public class BytesFormat
- extends Format
This class formats an instance of Bytes
,
Long
, Integer
, or Short
based on the currently configured BytesDisplay
preference.
- Since:
- 1.5
- See Also:
- Serialized Form
Constructor Summary |
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. |
DETAILED_DECIMAL_FORMAT
public static final String DETAILED_DECIMAL_FORMAT
- The default format string using for decimal byte values.
- See Also:
- Constant Field Values
BytesFormat
public BytesFormat()
- Create an instance with default behavior.
BytesFormat
public 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.
format
public 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.
Otherwise, format obj
using the default formatter.
- Specified by:
format
in class Format
parseObject
public Object parseObject(String source,
ParsePosition pos)
- Specified by:
parseObject
in class Format
getInstance
public static BytesFormat getInstance()
- Return a new instance of a BytesFormat with default options.