org.jfree.chart.util
Class HexNumberFormat
NumberFormat
org.jfree.chart.util.HexNumberFormat
A custom number formatter that formats numbers as hexadecimal strings.
There are some limitations, so be careful using this class.
static int | BYTE - Number of hexadecimal digits for a byte.
|
static int | DWORD - Number of hexadecimal digits for a double word.
|
static int | QWORD - Number of hexadecimal digits for a quad word.
|
static int | WORD - Number of hexadecimal digits for a word.
|
StringBuffer | format(double number, StringBuffer toAppendTo, FieldPosition pos) - Formats the specified number as a hexadecimal string.
|
StringBuffer | format(long number, StringBuffer toAppendTo, FieldPosition pos) - Formats the specified number as a hexadecimal string.
|
int | getNumberOfDigits() - Returns the number of digits.
|
Number | parse(String source, ParsePosition parsePosition) - Parsing is not implemented, so this method always returns
null .
|
void | setNumberOfDigits(int digits) - Sets the number of digits.
|
BYTE
public static final int BYTE
Number of hexadecimal digits for a byte.
DWORD
public static final int DWORD
Number of hexadecimal digits for a double word.
QWORD
public static final int QWORD
Number of hexadecimal digits for a quad word.
WORD
public static final int WORD
Number of hexadecimal digits for a word.
HexNumberFormat
public HexNumberFormat()
Creates a new instance with 8 digits.
HexNumberFormat
public HexNumberFormat(int digits)
Creates a new instance with the specified number of digits.
format
public StringBuffer format(double number,
StringBuffer toAppendTo,
FieldPosition pos)
Formats the specified number as a hexadecimal string. The decimal
fraction is ignored.
number
- the number to format.toAppendTo
- the buffer to append to (ignored here).pos
- the field position (ignored here).
format
public StringBuffer format(long number,
StringBuffer toAppendTo,
FieldPosition pos)
Formats the specified number as a hexadecimal string. The decimal
fraction is ignored.
number
- the number to format.toAppendTo
- the buffer to append to (ignored here).pos
- the field position (ignored here).
parse
public Number parse(String source,
ParsePosition parsePosition)
Parsing is not implemented, so this method always returns
null
.
source
- ignored.parsePosition
- ignored.
setNumberOfDigits
public void setNumberOfDigits(int digits)
Sets the number of digits.
digits
- the number of digits.