java.lang.Object | |
↳ | org.apache.commons.codec.binary.Hex |
Hex encoder and decoder. The charset used for certain operation can be set, the default is set in
DEFAULT_CHARSET_NAME
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
String | DEFAULT_CHARSET_NAME | Default charset name is UTF_8
|
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Creates a new codec with the default charset name
DEFAULT_CHARSET_NAME
| |||||||||||
Creates a new codec with the given charset name.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Converts an array of character bytes representing hexadecimal values into an array of bytes of those same values.
| |||||||||||
Converts a String or an array of character bytes representing hexadecimal values into an array of bytes of those
same values.
| |||||||||||
Converts an array of characters representing hexadecimal values into an array of bytes of those same values.
| |||||||||||
Converts an array of bytes into an array of bytes for the characters representing the hexadecimal values of each
byte in order.
| |||||||||||
Converts a String or an array of bytes into an array of characters representing the hexadecimal values of each
byte in order.
| |||||||||||
Converts an array of bytes into an array of characters representing the hexadecimal values of each byte in order.
| |||||||||||
Converts an array of bytes into an array of characters representing the hexadecimal values of each byte in order.
| |||||||||||
Converts an array of bytes into a String representing the hexadecimal values of each byte in order.
| |||||||||||
Gets the charset name.
| |||||||||||
Returns a string representation of the object, which includes the charset name.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Converts an array of bytes into an array of characters representing the hexadecimal values of each byte in order.
| |||||||||||
Converts a hexadecimal character to an integer.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
| |||||||||||
From interface
org.apache.commons.codec.BinaryDecoder
| |||||||||||
From interface
org.apache.commons.codec.BinaryEncoder
| |||||||||||
From interface
org.apache.commons.codec.Decoder
| |||||||||||
From interface
org.apache.commons.codec.Encoder
|
Default charset name is UTF_8
Creates a new codec with the given charset name.
csName | the charset name. |
---|
Converts an array of character bytes representing hexadecimal values into an array of bytes of those same values. The returned array will be half the length of the passed array, as it takes two characters to represent any given byte. An exception is thrown if the passed char array has an odd number of elements.
array | An array of character bytes containing hexadecimal digits |
---|
DecoderException | Thrown if an odd number of characters is supplied to this function |
---|
Converts a String or an array of character bytes representing hexadecimal values into an array of bytes of those same values. The returned array will be half the length of the passed String or array, as it takes two characters to represent any given byte. An exception is thrown if the passed char array has an odd number of elements.
object | A String or, an array of character bytes containing hexadecimal digits |
---|
DecoderException | Thrown if an odd number of characters is supplied to this function or the object is not a String or char[] |
---|
Converts an array of characters representing hexadecimal values into an array of bytes of those same values. The returned array will be half the length of the passed array, as it takes two characters to represent any given byte. An exception is thrown if the passed char array has an odd number of elements.
data | An array of characters containing hexadecimal digits |
---|
DecoderException | Thrown if an odd number or illegal of characters is supplied |
---|
Converts an array of bytes into an array of bytes for the characters representing the hexadecimal values of each byte in order. The returned array will be double the length of the passed array, as it takes two characters to represent any given byte.
The conversion from hexadecimal characters to the returned bytes is performed with the charset named by
getCharsetName()
.
array | a byte[] to convert to Hex characters |
---|
IllegalStateException | if the charsetName is invalid. This API throws IllegalStateException instead of UnsupportedEncodingException for backward compatibility. |
---|
Converts a String or an array of bytes into an array of characters representing the hexadecimal values of each byte in order. The returned array will be double the length of the passed String or array, as it takes two characters to represent any given byte.
The conversion from hexadecimal characters to bytes to be encoded to performed with the charset named by
getCharsetName()
.
object | a String, or byte[] to convert to Hex characters |
---|
EncoderException | Thrown if the given object is not a String or byte[] |
---|
Converts an array of bytes into an array of characters representing the hexadecimal values of each byte in order. The returned array will be double the length of the passed array, as it takes two characters to represent any given byte.
data | a byte[] to convert to Hex characters |
---|---|
toLowerCase | true converts to lowercase, false to uppercase |
Converts an array of bytes into an array of characters representing the hexadecimal values of each byte in order. The returned array will be double the length of the passed array, as it takes two characters to represent any given byte.
data | a byte[] to convert to Hex characters |
---|
Converts an array of bytes into a String representing the hexadecimal values of each byte in order. The returned String will be double the length of the passed array, as it takes two characters to represent any given byte.
data | a byte[] to convert to Hex characters |
---|
Gets the charset name.
Returns a string representation of the object, which includes the charset name.
Converts an array of bytes into an array of characters representing the hexadecimal values of each byte in order. The returned array will be double the length of the passed array, as it takes two characters to represent any given byte.
data | a byte[] to convert to Hex characters |
---|---|
toDigits | the output alphabet |
Converts a hexadecimal character to an integer.
ch | A character to convert to an integer digit |
---|---|
index | The index of the character in the source |
DecoderException | Thrown if ch is an illegal hex character |
---|