Interface ObjectDecoder<TYPE>

All Known Subinterfaces:
ObjectCodec<TYPE>
All Known Implementing Classes:
BigDecimalCodec, BigDecimalParquetBytesCodec, BigIntegerCodec, BigIntegerParquetBytesCodec, ByteArrayCodec, EncodedStringDecoder, ExternalizableCodec, IndexCodec, LocalDateCodec, LocalTimeCodec, MapCodec, SerializableCodec, SimpleStringDecoder, StringBooleanMapCodec, StringDoubleMapCodec, StringFloatMapCodec, StringIntMapCodec, StringLongMapCodec, StringStringMapCodec, UTF8StringAsByteArrayCodec, ZonedDateTimeCodec

public interface ObjectDecoder<TYPE>

Codec superinterface for Object translation from byte arrays for serialization and deserialization.

Implementations must follow several rules to enable correct usage:

  1. They must be stateless or designed for concurrent use (e.g. by using only ThreadLocal state), as they will generally be cached and re-used.
  2. They must not modify their inputs in any way, retain references to their inputs, or return results that retain references to their inputs.
  • Field Summary

    Fields 
    Modifier and Type Field Description
    static int VARIABLE_WIDTH_SENTINEL
    The value which represents variable width columns.
  • Method Summary

    Modifier and Type Method Description
    default void checkWidth​(int actualWidth)
    Verify that this codec is capable of supporting a column that has an actual width of actualWidth.
    TYPE decode​(byte[] input, int offset, int length)
    Decode an object from an array of bytes.
    int expectedObjectWidth()
    What width byte array does this ObjectCodec expect to encode and decode?
  • Field Details

  • Method Details

    • decode

      @Nullable TYPE decode​(@NotNull byte[] input, int offset, int length)
      Decode an object from an array of bytes.
      Parameters:
      input - The input byte array containing bytes to decode
      offset - The offset into the byte array to start decoding from
      length - The length of the byte array to decode from, starting at the offset
      Returns:
      The output object, possibly null
    • expectedObjectWidth

      int expectedObjectWidth()
      What width byte array does this ObjectCodec expect to encode and decode?
      Returns:
      VARIABLE_WIDTH_SENTINEL if the codec must encode and decode variable width columns, otherwise the fixed size of byte array that must be decoded and encoded.
    • checkWidth

      default void checkWidth​(int actualWidth) throws IllegalArgumentException
      Verify that this codec is capable of supporting a column that has an actual width of actualWidth.
      Parameters:
      actualWidth - the actual width of the instantiated column
      Throws:
      IllegalArgumentException - if actualWidth is not compatible with this codec