Interface ObjectDecoder<TYPE>

All Known Subinterfaces:
ObjectCodec<TYPE>
All Known Implementing Classes:
BigDecimalCodec, BigDecimalParquetBytesCodec, BigIntegerCodec, BigIntegerParquetBytesCodec, EncodedStringDecoder, ExternalizableCodec, LocalDateCodec, LocalTimeCodec, MapCodec, RowSetCodec, SerializableCodec, SimpleByteArrayCodec, 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 final int
    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.
    decode(byte @NotNull [] input, int offset, int length)
    Decode an object from an array of bytes.
    default TYPE
    decode(@NotNull ByteBuffer buffer)
    Decode an object from a ByteBuffer.
    int
    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:
  • Method Details

    • decode

      @Nullable TYPE decode(byte @NotNull [] 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 number of bytes to decode, starting at the offset
      Returns:
      The output object, possibly null
    • decode

      @Nullable default TYPE decode(@NotNull @NotNull ByteBuffer buffer)
      Decode an object from a ByteBuffer. The position of the input buffer may or may not be modified by this method.
      Parameters:
      buffer - The input ByteBuffer containing bytes to decode
      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