Class HexDigits
java.lang.Object
io.github.connellite.util.internal.HexDigits
ASCII hex digits: nibble lookup for
0-9, a-f, A-F, and lowercase encoding.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidappendHex(Appendable out, byte value) Appendsvalueas 2 lowercase hex digits.static voidappendHex(Appendable out, int value) Appendsvalueas 8 lowercase hex digits.static voidappendHex(Appendable out, long value) Appendsvalueas 16 lowercase hex digits, most significant nibble first.static voidappendHex(Appendable out, short value) Appendsvalueas 4 lowercase hex digits.static byte[]Decodes an even-length ASCII hex string into bytes.static inthexValue(int code) Returns the hex value ofcode, or-1when it is not an ASCII hex digit.static StringtoHex(byte[] bytes) Encodesbytesas lowercase hex, two characters per byte.
-
Constructor Details
-
HexDigits
public HexDigits()
-
-
Method Details
-
hexValue
public static int hexValue(int code) Returns the hex value ofcode, or-1when it is not an ASCII hex digit. -
appendHex
Appendsvalueas 2 lowercase hex digits. -
appendHex
Appendsvalueas 4 lowercase hex digits. -
appendHex
Appendsvalueas 8 lowercase hex digits. -
appendHex
Appendsvalueas 16 lowercase hex digits, most significant nibble first. -
toHex
Encodesbytesas lowercase hex, two characters per byte. -
fromHex
Decodes an even-length ASCII hex string into bytes.- Returns:
- decoded bytes, or
nullifhexcontains a non-hex character
-