Package io.deephaven.util.codec
Interface ObjectCodec<TYPE>
- All Superinterfaces:
ObjectDecoder<TYPE>
- All Known Implementing Classes:
BigDecimalCodec
,BigDecimalParquetBytesCodec
,BigIntegerCodec
,BigIntegerParquetBytesCodec
,ExternalizableCodec
,LocalDateCodec
,LocalTimeCodec
,MapCodec
,RowSetCodec
,SerializableCodec
,SimpleByteArrayCodec
,StringBooleanMapCodec
,StringDoubleMapCodec
,StringFloatMapCodec
,StringIntMapCodec
,StringLongMapCodec
,StringStringMapCodec
,UTF8StringAsByteArrayCodec
,ZonedDateTimeCodec
Codec interface for Object translation to/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.
- They should provide a public constructor that takes a single String argument, in order to allow configuration-driven reflective instantiation.
-
Field Summary
Fields inherited from interface io.deephaven.util.codec.ObjectDecoder
VARIABLE_WIDTH_SENTINEL
-
Method Summary
Modifier and TypeMethodDescriptionbyte @NotNull []
Encode the specified input as an array of bytes.int
If applicable, the maximum encodable precision.int
getScale()
If applicable, the maximum encodable scale.boolean
Does this codec support encoding of null values?Methods inherited from interface io.deephaven.util.codec.ObjectDecoder
checkWidth, decode, decode, expectedObjectWidth
-
Method Details
-
encode
Encode the specified input as an array of bytes. Note that it is up to the implementation how to encode null inputs. The use of a zero-length byte array is strongly encouraged.- Parameters:
input
- The input object, possibly null- Returns:
- The output byte array
-
isNullable
boolean isNullable()Does this codec support encoding of null values?- Returns:
- if null values are supported
-
getPrecision
int getPrecision()If applicable, the maximum encodable precision. If precision is not applicable (i.e. for non-numeric types) this method should return zero.- Returns:
- the numeric precision supported by this codec
-
getScale
int getScale()If applicable, the maximum encodable scale. If scale is not applicable (i.e. for non-numeric types) this method should return zero.- Returns:
- the numeric scale (digits after the decimal point) supported by this codec
-