Class ByteArrayEncoding

All Implemented Interfaces:
Encoding<byte[]>, NaturalSortAware, Serializable, Comparator<byte[]>

public class ByteArrayEncoding extends IntegralArrayEncoding<byte[],Byte>
byte[] primitive array type. Does not support null arrays.
See Also:
  • Constructor Details

    • ByteArrayEncoding

      public ByteArrayEncoding(EncodingId encodingId)
  • Method Details

    • withEncodingId

      public ByteArrayEncoding withEncodingId(EncodingId encodingId)
      Description copied from interface: Encoding
      Build an encoding that has the given EncodingId but is otherwise equivalent to this encoding.

      If this encoding already has encodingId, then this method may (but is not required to) return this same instance.

      Parameters:
      encodingId - new encoding's EncodingId, or null for an anonymized encoding
      Returns:
      a version of this encoding with the given EncodingId
    • getArrayLength

      protected int getArrayLength(byte[] array)
      Description copied from class: ArrayEncoding
      Get the length of the given array.
      Specified by:
      getArrayLength in class ArrayEncoding<byte[],Byte>
      Parameters:
      array - non-null array
      Returns:
      array length
    • getArrayElement

      protected Byte getArrayElement(byte[] array, int index)
      Description copied from class: ArrayEncoding
      Get an element from the given array.
      Specified by:
      getArrayElement in class ArrayEncoding<byte[],Byte>
      Parameters:
      array - non-null array
      index - index of target element in array
      Returns:
      array element at index index
    • createArray

      protected byte[] createArray(List<Byte> elements)
      Description copied from class: ArrayEncoding
      Create a new array instance containing the given elements.
      Specified by:
      createArray in class ArrayEncoding<byte[],Byte>
      Parameters:
      elements - content for the new array
      Returns:
      newly created array
    • encode

      protected void encode(byte[] array, DataOutputStream output) throws IOException
      Specified by:
      encode in class Base64ArrayEncoding<byte[],Byte>
      Throws:
      IOException
    • decode

      protected byte[] decode(DataInputStream input, int numBytes) throws IOException
      Specified by:
      decode in class Base64ArrayEncoding<byte[],Byte>
      Throws:
      IOException