public class

HexNumberFormat

extends NumberFormat
java.lang.Object
   ↳ java.text.Format
     ↳ java.text.NumberFormat
       ↳ org.jfree.chart.util.HexNumberFormat

Class Overview

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

Summary

Constants
int BYTE Number of hexadecimal digits for a byte.
int DWORD Number of hexadecimal digits for a double word.
int QWORD Number of hexadecimal digits for a quad word.
int WORD Number of hexadecimal digits for a word.
[Expand]
Inherited Constants
From class java.text.NumberFormat
Public Constructors
HexNumberFormat()
Creates a new instance with 8 digits.
HexNumberFormat(int digits)
Creates a new instance with the specified number of digits.
Public Methods
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.
final 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.
[Expand]
Inherited Methods
From class java.text.NumberFormat
From class java.text.Format
From class java.lang.Object

Constants

public static final int BYTE

Number of hexadecimal digits for a byte.

Constant Value: 2 (0x00000002)

public static final int DWORD

Number of hexadecimal digits for a double word.

Constant Value: 8 (0x00000008)

public static final int QWORD

Number of hexadecimal digits for a quad word.

Constant Value: 16 (0x00000010)

public static final int WORD

Number of hexadecimal digits for a word.

Constant Value: 4 (0x00000004)

Public Constructors

public HexNumberFormat ()

Creates a new instance with 8 digits.

public HexNumberFormat (int digits)

Creates a new instance with the specified number of digits.

Parameters
digits the digits.

Public Methods

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.

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.

public final int getNumberOfDigits ()

Returns the number of digits.

Returns
  • The number of digits.

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.

public void setNumberOfDigits (int digits)

Sets the number of digits.

Parameters
digits the number of digits.