Package org.jfree.chart.util
Class HexNumberFormat
java.lang.Object
java.text.Format
java.text.NumberFormat
org.jfree.chart.util.HexNumberFormat
- All Implemented Interfaces:
Serializable
,Cloneable
A custom number formatter that formats numbers as hexadecimal strings.
There are some limitations, so be careful using this class.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.text.NumberFormat
NumberFormat.Field, NumberFormat.Style
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Number of hexadecimal digits for a byte.static final int
Number of hexadecimal digits for a double word.static final int
Number of hexadecimal digits for a quad word.static final int
Number of hexadecimal digits for a word.Fields inherited from class java.text.NumberFormat
FRACTION_FIELD, INTEGER_FIELD
-
Constructor Summary
ConstructorDescriptionCreates a new instance with 8 digits.HexNumberFormat
(int digits) Creates a new instance with the specified number of digits. -
Method Summary
Modifier and TypeMethodDescriptionformat
(double number, StringBuffer toAppendTo, FieldPosition pos) Formats the specified number as a hexadecimal string.format
(long number, StringBuffer toAppendTo, FieldPosition pos) Formats the specified number as a hexadecimal string.final int
Returns the number of digits.parse
(String source, ParsePosition parsePosition) Parsing is not implemented, so this method always returnsnull
.void
setNumberOfDigits
(int digits) Sets the number of digits.Methods inherited from class java.text.NumberFormat
clone, equals, format, format, format, getAvailableLocales, getCompactNumberInstance, getCompactNumberInstance, getCurrency, getCurrencyInstance, getCurrencyInstance, getInstance, getInstance, getIntegerInstance, getIntegerInstance, getMaximumFractionDigits, getMaximumIntegerDigits, getMinimumFractionDigits, getMinimumIntegerDigits, getNumberInstance, getNumberInstance, getPercentInstance, getPercentInstance, getRoundingMode, hashCode, isGroupingUsed, isParseIntegerOnly, parse, parseObject, setCurrency, setGroupingUsed, setMaximumFractionDigits, setMaximumIntegerDigits, setMinimumFractionDigits, setMinimumIntegerDigits, setParseIntegerOnly, setRoundingMode
Methods inherited from class java.text.Format
format, formatToCharacterIterator, parseObject
-
Field Details
-
BYTE
Number of hexadecimal digits for a byte.- See Also:
-
WORD
Number of hexadecimal digits for a word.- See Also:
-
DWORD
Number of hexadecimal digits for a double word.- See Also:
-
QWORD
Number of hexadecimal digits for a quad word.- See Also:
-
-
Constructor Details
-
HexNumberFormat
public HexNumberFormat()Creates a new instance with 8 digits. -
HexNumberFormat
Creates a new instance with the specified number of digits.- Parameters:
digits
- the digits.
-
-
Method Details
-
getNumberOfDigits
Returns the number of digits.- Returns:
- The number of digits.
-
setNumberOfDigits
Sets the number of digits.- Parameters:
digits
- the number of digits.
-
format
Formats the specified number as a hexadecimal string. The decimal fraction is ignored.- Specified by:
format
in classNumberFormat
- Parameters:
number
- the number to format.toAppendTo
- the buffer to append to (ignored here).pos
- the field position (ignored here).- Returns:
- The string buffer.
-
format
Formats the specified number as a hexadecimal string. The decimal fraction is ignored.- Specified by:
format
in classNumberFormat
- Parameters:
number
- the number to format.toAppendTo
- the buffer to append to (ignored here).pos
- the field position (ignored here).- Returns:
- The string buffer.
-
parse
Parsing is not implemented, so this method always returnsnull
.- Specified by:
parse
in classNumberFormat
- Parameters:
source
- ignored.parsePosition
- ignored.- Returns:
- Always
null
.
-