java.lang.Object
dev.getelements.elements.sdk.util.Hex
Direct Known Subclasses:
Hex

public class Hex extends Object
  • Field Details

  • Constructor Details

    • Hex

      public Hex()
  • Method Details

    • forNibble

      public static char forNibble(int nibble, Hex.Case c)
      Gets a characte for the supplied nibble.
      Parameters:
      nibble - the nibble
      c - the desired case format
      Returns:
      the char for the nibble.
    • encode

      public static String encode(byte[] raw)
      Encodes hex to to lower-case hex encoding.
      Parameters:
      raw - the raw byte value
      Returns:
      the String representing the hex string
    • encode

      public static String encode(byte[] raw, Hex.Case c)
      Encodes hex to to lower-case hex encoding.
      Parameters:
      raw - the raw byte value
      c - the Hex.Case
      Returns:
      the String representing the hex string
    • encode

      public static String encode(ByteBuffer raw)
      Encodes hex to to lower-case hex encoding.
      Parameters:
      raw - the raw byte value
      Returns:
      the String representing the hex string
    • encode

      public static String encode(ByteBuffer raw, Hex.Case c)
      Encodes hex to to lower-case hex encoding.
      Parameters:
      raw - the raw byte value
      c - the Hex.Case
      Returns:
      the String representing the hex string
    • decode

      public static byte[] decode(String hex)
      Decodes a String into raw hexadecimal bytes.
      Parameters:
      hex - the hex string
      Returns:
      a
      invalid reference
      byte[]
      representing the hex
    • decodeToBuffer

      public static ByteBuffer decodeToBuffer(String hex)
      Decodes a String into raw hexadecimal bytes, allocating a new ByteBuffer for storage.
      Parameters:
      hex - the hex string
      Returns:
      a
      invalid reference
      byte[]
      representing the hex
    • decodeToBuffer

      public static ByteBuffer decodeToBuffer(String hex, Hex.ByteBufferAllocator byteBufferAllocator)
      Decodes a String into raw hexadecimal bytes, allocating a new ByteBuffer for storage using the supplied Hex.ByteBufferAllocator.
      Parameters:
      hex - the hex string
      Returns:
      a
      invalid reference
      byte[]
      representing the hex