Class IntegralArrayEncoding<T,E extends Number>

All Implemented Interfaces:
Encoding<T>, NaturalSortAware, Serializable, Comparator<T>
Direct Known Subclasses:
ByteArrayEncoding, IntegerArrayEncoding, LongArrayEncoding, ShortArrayEncoding

public abstract class IntegralArrayEncoding<T,E extends Number> extends Base64ArrayEncoding<T,E>
Array type for integral primitive element types. Does not support null arrays.

Arrays are encoded as a sequence of numerical values followed by 0x00, where each value is encoded via LongEncoder. Note, we take advantage of the fact that LongEncoder does not emit values starting with 0x00.

See Also:
  • Constructor Details

  • Method Details

    • read

      public T read(ByteReader reader)
      Description copied from interface: Encoding
      Read a value from the given input.
      Parameters:
      reader - byte input
      Returns:
      field value (possibly null)
    • write

      public void write(ByteWriter writer, T array)
      Description copied from interface: Encoding
      Write a value to the given output.
      Parameters:
      writer - byte output
      array - value to write (possibly null)
    • skip

      public void skip(ByteReader reader)
      Description copied from interface: Encoding
      Read and discard a byte[] encoded value from the given input.
      Parameters:
      reader - byte input
    • hasPrefix0xff

      public boolean hasPrefix0xff()
      Description copied from interface: Encoding
      Determine whether any of this encoding's encoded values start with a 0xff byte. Certain optimizations are possible when this is not the case. It is safe for this method to always return true.

      Note: changing the result of this method may result in an incompatible encoding if this encoding is wrapped in another class.

      The implementation in Encoding returns true.

      Returns:
      true if an encoded value starting with 0xff exists