public final class Hex extends Object
Constructor and Description |
---|
Hex() |
Modifier and Type | Method and Description |
---|---|
static Appendable |
append(Appendable a,
byte[] bytes)
Turns a
byte array into hex octets. |
static Appendable |
append(Appendable a,
int in)
Turns an
int into hex octets. |
static Appendable |
append(Appendable a,
int in,
int length)
Turns an
int into hex octets. |
static Appendable |
append(Appendable a,
long in)
Turns a
long into hex octets. |
static Appendable |
append(Appendable a,
long in,
int length)
Turns a
long into hex octets. |
static Appendable |
append(Appendable a,
short in)
Turns a
short into hex octets. |
static Appendable |
append(Appendable a,
short in,
int length)
Turns a
short into hex octets. |
static long |
parseLong(CharSequence s)
Parses a
long from a hex encoded number. |
static short |
parseShort(String s)
Parses a
short from a hex encoded number. |
public static Appendable append(Appendable a, short in)
short
into hex octets.a
- the Appendable
, may not be null
in
- the integerAppendable
public static Appendable append(Appendable a, short in, int length)
short
into hex octets.a
- the Appendable
, may not be null
in
- the integerlength
- the number of octets to produceAppendable
public static Appendable append(Appendable a, int in)
int
into hex octets.a
- the Appendable
, may not be null
in
- the integerAppendable
public static Appendable append(Appendable a, int in, int length)
int
into hex octets.a
- the Appendable
, may not be null
in
- the integerlength
- the number of octets to produceAppendable
public static Appendable append(Appendable a, long in)
long
into hex octets.a
- the Appendable
, may not be null
in
- the longAppendable
public static Appendable append(Appendable a, long in, int length)
long
into hex octets.a
- the Appendable
, may not be null
in
- the longlength
- the number of octets to produceAppendable
public static Appendable append(Appendable a, byte[] bytes)
byte
array into hex octets.a
- the Appendable
, may not be null
bytes
- the byte
arrayAppendable
public static long parseLong(CharSequence s)
long
from a hex encoded number. This method will skip all characters that are not 0-9,
A-F and a-f.
Returns 0 if the CharSequence
does not contain any interesting characters.
s
- the CharSequence
to extract a long
from, may not be null
long
NullPointerException
- if the CharSequence
is null
public static short parseShort(String s)
short
from a hex encoded number. This method will skip all characters that are not 0-9,
A-F and a-f.
Returns 0 if the CharSequence
does not contain any interesting characters.
s
- the CharSequence
to extract a short
from, may not be null
short
NullPointerException
- if the CharSequence
is null
Copyright © 2003–2018. All rights reserved.