Package io.deephaven.util.codec
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:
- 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.
- 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
Modifier and TypeFieldDescriptionstatic final int
The value which represents variable width columns. -
Method Summary
Modifier and TypeMethodDescriptiondefault void
checkWidth
(int actualWidth) Verify that this codec is capable of supporting a column that has an actual width ofactualWidth
.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_SENTINELThe value which represents variable width columns.- See Also:
-
-
Method Details
-
decode
Decode an object from an array of bytes.- Parameters:
input
- The input byte array containing bytes to decodeoffset
- The offset into the byte array to start decoding fromlength
- The number of bytes to decode, starting at the offset- Returns:
- The output object, possibly null
-
decode
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
Verify that this codec is capable of supporting a column that has an actual width ofactualWidth
.- Parameters:
actualWidth
- the actual width of the instantiated column- Throws:
IllegalArgumentException
- ifactualWidth
is not compatible with this codec
-