java.lang.Object
org.seppiko.commons.utils.codec.Base16
- All Implemented Interfaces:
Serializable,BaseNCodec
Base16 encoding and decoding.
- Author:
- Leonard Woo
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Base16The used lowercase alphabet.static final Base16The used uppercase alphabet.static final Base16The most widely used Base16 alphabet is defined in RFC 4648.static final Base16The most widely used Base16 alphabet is defined in RFC 4648 with uppercase.Fields inherited from interface org.seppiko.commons.utils.codec.BaseNCodec
BIT_WIDTH, BYTES_PER_ENCODED_BLOCK, MASK_2BITS, MASK_4BITS, MASK_5BITS, MASK_6BITS, MASK_8BITS, MASK_UPPER_4BITS -
Method Summary
Modifier and TypeMethodDescriptionbyte[]convert Base16 to byte array.encodeString(byte[] data) convert byte array to Base16.
-
Field Details
-
RFC4648
The most widely used Base16 alphabet is defined in RFC 4648. -
RFC4648_UPPER
The most widely used Base16 alphabet is defined in RFC 4648 with uppercase. -
BASE16_UPPERCASE
The used uppercase alphabet. -
BASE16_CASE
The used lowercase alphabet.
-
-
Method Details
-
encodeString
convert byte array to Base16.- Specified by:
encodeStringin interfaceBaseNCodec- Parameters:
data- byte array data.- Returns:
- hex char array.
-
decode
convert Base16 to byte array.- Specified by:
decodein interfaceBaseNCodec- Parameters:
str- hex char array.- Returns:
- byte array.
- Throws:
IllegalArgumentException- data include invalid character.NullPointerException- data is null or empty.
-