Class Hex
java.lang.Object
dev.getelements.elements.sdk.util.Hex
- Direct Known Subclasses:
Hex
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfacestatic enumThe case (upper or lower case).static classThrown when the hex string is not valid. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic byte[]Decodes aStringinto raw hexadecimal bytes.static ByteBufferdecodeToBuffer(String hex) Decodes aStringinto raw hexadecimal bytes, allocating a newByteBufferfor storage.static ByteBufferdecodeToBuffer(String hex, Hex.ByteBufferAllocator byteBufferAllocator) Decodes aStringinto raw hexadecimal bytes, allocating a newByteBufferfor storage using the suppliedHex.ByteBufferAllocator.static Stringencode(byte[] raw) Encodes hex to to lower-case hex encoding.static StringEncodes hex to to lower-case hex encoding.static Stringencode(ByteBuffer raw) Encodes hex to to lower-case hex encoding.static Stringencode(ByteBuffer raw, Hex.Case c) Encodes hex to to lower-case hex encoding.static charGets a characte for the supplied nibble.
-
Field Details
-
VALID_REGEX
- See Also:
-
VALID_PATTERN
-
-
Constructor Details
-
Hex
public Hex()
-
-
Method Details
-
forNibble
Gets a characte for the supplied nibble.- Parameters:
nibble- the nibblec- the desired case format- Returns:
- the char for the nibble.
-
encode
Encodes hex to to lower-case hex encoding.- Parameters:
raw- the raw byte value- Returns:
- the
Stringrepresenting the hex string
-
encode
Encodes hex to to lower-case hex encoding. -
encode
Encodes hex to to lower-case hex encoding.- Parameters:
raw- the raw byte value- Returns:
- the
Stringrepresenting the hex string
-
encode
Encodes hex to to lower-case hex encoding. -
decode
Decodes aStringinto raw hexadecimal bytes.- Parameters:
hex- the hex string- Returns:
- a
representing the hex
invalid reference
byte[]
-
decodeToBuffer
Decodes aStringinto raw hexadecimal bytes, allocating a newByteBufferfor storage.- Parameters:
hex- the hex string- Returns:
- a
representing the hex
invalid reference
byte[]
-
decodeToBuffer
Decodes aStringinto raw hexadecimal bytes, allocating a newByteBufferfor storage using the suppliedHex.ByteBufferAllocator.- Parameters:
hex- the hex string- Returns:
- a
representing the hex
invalid reference
byte[]
-