|
jET |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--java.text.Format
|
+--prv.doman.util.HexadecimalFormat
This class enables format and parse hexadecimal numbers. It works with Java standard types of numbers: byte, short, int, and long. Floating point types are discarded.
Hexadacimal format is not locale dependent.
| Field Summary | |
static int |
DECORATION_NONE
Decoration means additional format of hexadacimal format. |
static int |
DECORATION_PREFIX
Sets at the begining of output symbols: 0x. |
static int |
DECORATION_SUFFIX
Sets at the end of output symbol: h. |
| Constructor Summary | |
HexadecimalFormat()
Creates default hexadecimal formatter. |
|
| Method Summary | |
java.lang.String |
format(byte b)
Format single byte. |
java.lang.StringBuffer |
format(byte b,
java.lang.StringBuffer toAppendTo,
java.text.FieldPosition pos)
Formats single byte to the hexadecimal textual representation. |
java.lang.String |
format(int i)
Formats integer value to the hexadecimal representation. |
java.lang.StringBuffer |
format(int i,
java.lang.StringBuffer toAppendTo,
java.text.FieldPosition pos)
Formats integer value to the hexidecimal textual representation. |
java.lang.String |
format(long l)
Formats long value to the hexadecimal representation. |
java.lang.StringBuffer |
format(long l,
java.lang.StringBuffer toAppendTo,
java.text.FieldPosition pos)
Formats long value to the hexidecimal textual representation. |
java.lang.StringBuffer |
format(java.lang.Object obj,
java.lang.StringBuffer toAppendTo,
java.text.FieldPosition pos)
See note on superclass. |
java.lang.String |
format(short s)
Formats short value to the hexadecimal textual representation. |
java.lang.StringBuffer |
format(short s,
java.lang.StringBuffer toAppendTo,
java.text.FieldPosition pos)
Formats short value to the hexidecimal textual representation. |
int |
getDecoration()
Gets decoration style of this format. |
boolean |
isLowerCase()
Checks if hexadecimal digits from a to f are
lower or upper cased in this format. |
java.lang.Number |
parse(java.lang.String source)
Parses text containing hexadecimal number. |
java.lang.Number |
parse(java.lang.String source,
java.text.ParsePosition pos)
Parses text at specified position. |
java.lang.Object |
parseObject(java.lang.String source,
java.text.ParsePosition pos)
Parses text to find hexadecimal numbers. |
void |
setDecoration(int d)
Sets decoration for this format. |
void |
toLowerCase()
Sets hexadecimal digits from a to f to be
lower cased. |
void |
toUpperCase()
Sets hexadecimal digits from a to f to be
upper cased. |
| Methods inherited from class java.text.Format |
clone, format, formatToCharacterIterator, parseObject |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final int DECORATION_NONE
public static final int DECORATION_PREFIX
0x.
public static final int DECORATION_SUFFIX
h.
| Constructor Detail |
public HexadecimalFormat()
0 - 9 and a
- f. It defines no decoration and lower case.
| Method Detail |
public java.lang.StringBuffer format(java.lang.Object obj,
java.lang.StringBuffer toAppendTo,
java.text.FieldPosition pos)
format in class java.text.Formatpublic final java.lang.String format(byte b)
b - Byte value.
public java.lang.StringBuffer format(byte b,
java.lang.StringBuffer toAppendTo,
java.text.FieldPosition pos)
b - Byte value.toAppendTo - String buffer where append to.pos - Unused.public final java.lang.String format(short s)
s - Short value.
public java.lang.StringBuffer format(short s,
java.lang.StringBuffer toAppendTo,
java.text.FieldPosition pos)
s - Short value.toAppendTo - Where text should be appended.pos - Unused.
public final java.lang.String format(int i)
i - Integer value.
public java.lang.StringBuffer format(int i,
java.lang.StringBuffer toAppendTo,
java.text.FieldPosition pos)
i - Integer value.toAppendTo - Where text should be appended.pos - Unused.
public final java.lang.String format(long l)
l - Long value.
public java.lang.StringBuffer format(long l,
java.lang.StringBuffer toAppendTo,
java.text.FieldPosition pos)
l - Long value.toAppendTo - Where text should be appended.pos - Unused.
public final java.lang.Object parseObject(java.lang.String source,
java.text.ParsePosition pos)
parseObject in class java.text.Formatsource - Text to search.pos - Starting position of searching.
public java.lang.Number parse(java.lang.String source,
java.text.ParsePosition pos)
source - Source of text.pos - Position to start searching from.
public java.lang.Number parse(java.lang.String source)
throws java.text.ParseException
0x or
suffix h.
Exception is thrown when number hasn't got proper digit count or has bad format, or text isn't a hexadecimal number.
source - Text containing hexadecimal number.
java.text.ParseException - Exception.public void setDecoration(int d)
d - Decoration styles as integer.public int getDecoration()
public void toUpperCase()
a to f to be
upper cased.
public void toLowerCase()
a to f to be
lower cased.
public boolean isLowerCase()
a to f are
lower or upper cased in this format.
|
jET |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||