Class OtelEncodingUtils


  • @Immutable
    public final class OtelEncodingUtils
    extends java.lang.Object
    This class is internal and is hence not for public use. Its APIs are unstable and can change at any time.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private OtelEncodingUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      private static byte[] buildDecodingArray()  
      private static char[] buildEncodingArray()  
      private static boolean[] buildValidHexArray()  
      static byte byteFromBase16​(char first, char second)
      Decodes the specified two character sequence, and returns the resulting byte.
      static byte[] bytesFromBase16​(java.lang.CharSequence value, int length)
      Returns the byte[] decoded from the given hex CharSequence.
      static void bytesFromBase16​(java.lang.CharSequence value, int length, byte[] bytes)
      Fills bytes with bytes decoded from the given hex CharSequence.
      static void bytesToBase16​(byte[] bytes, char[] dest, int length)
      Fills dest with the hex encoding of bytes.
      static void byteToBase16​(byte value, char[] dest, int destOffset)
      Encodes the specified byte, and returns the encoded String.
      static boolean isValidBase16Character​(char b)
      Returns whether the given char is a valid hex character.
      static boolean isValidBase16String​(java.lang.CharSequence value)
      Returns whether the CharSequence is a valid hex string.
      static long longFromBase16String​(java.lang.CharSequence chars, int offset)
      Returns the long value whose base16 representation is stored in the first 16 chars of chars starting from the offset.
      static void longToBase16String​(long value, char[] dest, int destOffset)
      Appends the base16 encoding of the specified value to the dest.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • OtelEncodingUtils

        private OtelEncodingUtils()
    • Method Detail

      • buildEncodingArray

        private static char[] buildEncodingArray()
      • buildDecodingArray

        private static byte[] buildDecodingArray()
      • buildValidHexArray

        private static boolean[] buildValidHexArray()
      • longFromBase16String

        public static long longFromBase16String​(java.lang.CharSequence chars,
                                                int offset)
        Returns the long value whose base16 representation is stored in the first 16 chars of chars starting from the offset.
        Parameters:
        chars - the base16 representation of the long.
        offset - the starting offset in the CharSequence.
      • longToBase16String

        public static void longToBase16String​(long value,
                                              char[] dest,
                                              int destOffset)
        Appends the base16 encoding of the specified value to the dest.
        Parameters:
        value - the value to be converted.
        dest - the destination char array.
        destOffset - the starting offset in the destination char array.
      • bytesFromBase16

        public static byte[] bytesFromBase16​(java.lang.CharSequence value,
                                             int length)
        Returns the byte[] decoded from the given hex CharSequence.
      • bytesFromBase16

        public static void bytesFromBase16​(java.lang.CharSequence value,
                                           int length,
                                           byte[] bytes)
        Fills bytes with bytes decoded from the given hex CharSequence.
      • bytesToBase16

        public static void bytesToBase16​(byte[] bytes,
                                         char[] dest,
                                         int length)
        Fills dest with the hex encoding of bytes.
      • byteToBase16

        public static void byteToBase16​(byte value,
                                        char[] dest,
                                        int destOffset)
        Encodes the specified byte, and returns the encoded String.
        Parameters:
        value - the value to be converted.
        dest - the destination char array.
        destOffset - the starting offset in the destination char array.
      • byteFromBase16

        public static byte byteFromBase16​(char first,
                                          char second)
        Decodes the specified two character sequence, and returns the resulting byte.
        Parameters:
        first - the first hex character.
        second - the second hex character.
        Returns:
        the resulting byte
      • isValidBase16String

        public static boolean isValidBase16String​(java.lang.CharSequence value)
        Returns whether the CharSequence is a valid hex string.
      • isValidBase16Character

        public static boolean isValidBase16Character​(char b)
        Returns whether the given char is a valid hex character.