Interface ObjectDecoder<TYPE>

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

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

    • VARIABLE_WIDTH_SENTINEL

      static final int VARIABLE_WIDTH_SENTINEL
      The value which represents variable width columns.
      See Also:
      Constant Field Values
  • 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