org.jfree.chart.util

Class HexNumberFormat

public class HexNumberFormat extends NumberFormat

A custom number formatter that formats numbers as hexadecimal strings. There are some limitations, so be careful using this class.

Since: 1.0.6

Field Summary
static intBYTE
Number of hexadecimal digits for a byte.
static intDWORD
Number of hexadecimal digits for a double word.
static intQWORD
Number of hexadecimal digits for a quad word.
static intWORD
Number of hexadecimal digits for a word.
Constructor Summary
HexNumberFormat()
Creates a new instance with 8 digits.
HexNumberFormat(int digits)
Creates a new instance with the specified number of digits.
Method Summary
StringBufferformat(double number, StringBuffer toAppendTo, FieldPosition pos)
Formats the specified number as a hexadecimal string.
StringBufferformat(long number, StringBuffer toAppendTo, FieldPosition pos)
Formats the specified number as a hexadecimal string.
intgetNumberOfDigits()
Returns the number of digits.
Numberparse(String source, ParsePosition parsePosition)
Parsing is not implemented, so this method always returns null.
voidsetNumberOfDigits(int digits)
Sets the number of digits.

Field Detail

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.

Constructor Detail

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.

Parameters: digits the digits.

Method Detail

format

public StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition pos)
Formats the specified number as a hexadecimal string. The decimal fraction is ignored.

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

public StringBuffer format(long number, StringBuffer toAppendTo, FieldPosition pos)
Formats the specified number as a hexadecimal string. The decimal fraction is ignored.

Parameters: number the number to format. toAppendTo the buffer to append to (ignored here). pos the field position (ignored here).

Returns: The string buffer.

getNumberOfDigits

public final int getNumberOfDigits()
Returns the number of digits.

Returns: The number of digits.

parse

public Number parse(String source, ParsePosition parsePosition)
Parsing is not implemented, so this method always returns null.

Parameters: source ignored. parsePosition ignored.

Returns: Always null.

setNumberOfDigits

public void setNumberOfDigits(int digits)
Sets the number of digits.

Parameters: digits the number of digits.

Copyright © 2000-2009 by Object Refinery Limited. All Rights Reserved.