Package com.illumon.util.codec
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:
- 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
Fields Modifier and Type Field Description static intVARIABLE_WIDTH_SENTINELThe value which represents variable width columns. -
Method Summary
Modifier and Type Method Description default voidcheckWidth(int actualWidth)Verify that this codec is capable of supporting a column that has an actual width ofactualWidth.TYPEdecode(byte[] input, int offset, int length)Decode an object from an array of bytes.intexpectedObjectWidth()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:
- Constant Field Values
-
-
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 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
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- ifactualWidthis not compatible with this codec
-