Class BigendianEncoding

java.lang.Object
io.opencensus.trace.BigendianEncoding

final class BigendianEncoding extends Object
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private static final String
     
    private static final int
     
    (package private) static final int
     
    private static final byte[]
     
    private static final char[]
     
    (package private) static final int
     
    (package private) static final int
     
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
     
  • Method Summary

    Modifier and Type
    Method
    Description
    private static byte[]
     
    private static char[]
     
    (package private) static byte
    byteFromBase16String(CharSequence chars, int offset)
    Decodes the specified two character sequence, and returns the resulting byte.
    private static void
    byteToBase16(byte value, char[] dest, int destOffset)
     
    (package private) static void
    byteToBase16String(byte value, char[] dest, int destOffset)
    Encodes the specified byte, and returns the encoded String.
    private static byte
    decodeByte(char hi, char lo)
     
    (package private) static long
    longFromBase16String(CharSequence chars, int offset)
    Returns the long value whose base16 representation is stored in the first 16 chars of chars starting from the offset.
    (package private) static long
    longFromByteArray(byte[] bytes, int offset)
    Returns the long value whose big-endian representation is stored in the first 8 bytes of bytes starting from the offset.
    (package private) static void
    longToBase16String(long value, char[] dest, int destOffset)
    Appends the base16 encoding of the specified value to the dest.
    (package private) static void
    longToByteArray(long value, byte[] dest, int destOffset)
    Stores the big-endian representation of value in the dest starting from the destOffset.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • BigendianEncoding

      private BigendianEncoding()
  • Method Details

    • buildEncodingArray

      private static char[] buildEncodingArray()
    • buildDecodingArray

      private static byte[] buildDecodingArray()
    • longFromByteArray

      static long longFromByteArray(byte[] bytes, int offset)
      Returns the long value whose big-endian representation is stored in the first 8 bytes of bytes starting from the offset.
      Parameters:
      bytes - the byte array representation of the long.
      offset - the starting offset in the byte array.
      Returns:
      the long value whose big-endian representation is given.
      Throws:
      IllegalArgumentException - if bytes has fewer than 8 elements.
    • longToByteArray

      static void longToByteArray(long value, byte[] dest, int destOffset)
      Stores the big-endian representation of value in the dest starting from the destOffset.
      Parameters:
      value - the value to be converted.
      dest - the destination byte array.
      destOffset - the starting offset in the destination byte array.
    • longFromBase16String

      static long longFromBase16String(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

      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.
    • byteToBase16String

      static void byteToBase16String(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.
    • byteFromBase16String

      static byte byteFromBase16String(CharSequence chars, int offset)
      Decodes the specified two character sequence, and returns the resulting byte.
      Parameters:
      chars - the character sequence to be decoded.
      offset - the starting offset in the CharSequence.
      Returns:
      the resulting byte
      Throws:
      IllegalArgumentException - if the input is not a valid encoded string according to this encoding.
    • decodeByte

      private static byte decodeByte(char hi, char lo)
    • byteToBase16

      private static void byteToBase16(byte value, char[] dest, int destOffset)