Package io.deephaven.util.codec
Class LocalTimeCodec
java.lang.Object
io.deephaven.util.codec.LocalTimeCodec
- All Implemented Interfaces:
ObjectCodec<LocalTime>,ObjectDecoder<LocalTime>
LocalTime codec, with support for nanosecond, millisecond, or second precision. This codec always uses a fixed-width
encoding, the size of which depends on the desired precision.
The Nanos (default) encoding is a 6-byte packed-integer format that can represent the full range of times that a
LocalTime can represent.
The Millis encoding is a 4-byte packed-integer format. Sub-millisecond values are truncated.
The Seconds encoding is a 3-byte packed-integer format. Sub-second values are truncated.
All encodings are "nullable". Since every encoding leaves room for at least one "extra" bit, the leading bit always
indicates null - non-null values will always contain zero for the 1st bit.
-
Field Summary
Fields inherited from interface io.deephaven.util.codec.ObjectDecoder
VARIABLE_WIDTH_SENTINEL -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@Nullable LocalTimedecode(byte @NotNull [] input, int offset, int length) Decode an object from an array of bytes.byte @NotNull []Encode the specified input as an array of bytes.intWhat width byte array does this ObjectCodec expect to encode and decode?intIf applicable, the maximum encodable precision.intgetScale()If applicable, the maximum encodable scale.booleanDoes this codec support encoding of null values?Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.deephaven.util.codec.ObjectDecoder
checkWidth, decode
-
Constructor Details
-
LocalTimeCodec
-
-
Method Details
-
isNullable
public boolean isNullable()Description copied from interface:ObjectCodecDoes this codec support encoding of null values?- Specified by:
isNullablein interfaceObjectCodec<LocalTime>- Returns:
- if null values are supported
-
getPrecision
public int getPrecision()Description copied from interface:ObjectCodecIf applicable, the maximum encodable precision. If precision is not applicable (i.e. for non-numeric types) this method should return zero.- Specified by:
getPrecisionin interfaceObjectCodec<LocalTime>- Returns:
- the numeric precision supported by this codec
-
getScale
public int getScale()Description copied from interface:ObjectCodecIf applicable, the maximum encodable scale. If scale is not applicable (i.e. for non-numeric types) this method should return zero.- Specified by:
getScalein interfaceObjectCodec<LocalTime>- Returns:
- the numeric scale (digits after the decimal point) supported by this codec
-
encode
Description copied from interface:ObjectCodecEncode 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.- Specified by:
encodein interfaceObjectCodec<LocalTime>- Parameters:
input- The input object, possibly null- Returns:
- The output byte array
-
decode
Description copied from interface:ObjectDecoderDecode an object from an array of bytes.- Specified by:
decodein interfaceObjectDecoder<LocalTime>- 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
-
expectedObjectWidth
public int expectedObjectWidth()Description copied from interface:ObjectDecoderWhat width byte array does this ObjectCodec expect to encode and decode?- Specified by:
expectedObjectWidthin interfaceObjectDecoder<LocalTime>- 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.
-