Package io.deephaven.enterprise.codec
Class IntArrayCodec
java.lang.Object
io.deephaven.enterprise.codec.IntArrayCodec
- All Implemented Interfaces:
io.deephaven.util.codec.ObjectCodec<int[]>,io.deephaven.util.codec.ObjectDecoder<int[]>
- Direct Known Subclasses:
IntArrayCodec
An
ObjectCodec that encodes a int[] using one integer to indicate the array size and then the array
items sequentially.-
Field Summary
Fields inherited from interface io.deephaven.util.codec.ObjectDecoder
VARIABLE_WIDTH_SENTINEL -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@org.jetbrains.annotations.Nullable int[]decode(@org.jetbrains.annotations.NotNull byte[] input, int offset, int length) @org.jetbrains.annotations.Nullable int[]decode(@NotNull ByteBuffer byteBuffer) Decode a int array from the inputByteBufferstatic @org.jetbrains.annotations.Nullable int[]decodeStatic(@Nullable ByteBuffer byteBuffer) @org.jetbrains.annotations.NotNull byte[]encode(@org.jetbrains.annotations.Nullable int[] input) encodeAndGet(int[] input) Encode the input array into the internal buffer and return it.static voidencodeInto(@org.jetbrains.annotations.Nullable int[] input, @NotNull ByteBuffer byteBuffer) Encode the input values to the specified buffer.intintintgetScale()booleanstatic @NotNull ByteBuffermaybeGetResizedBuffer(@org.jetbrains.annotations.Nullable int[] input, @Nullable ByteBuffer origBuffer) Inspect the input buffer.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
-
Constructor Details
-
IntArrayCodec
public IntArrayCodec() -
IntArrayCodec
-
IntArrayCodec
-
-
Method Details
-
encodeAndGet
Encode the input array into the internal buffer and return it.- Parameters:
input- the array to encode- Returns:
- a reference to the internal byte buffer
-
maybeGetResizedBuffer
@NotNull public static @NotNull ByteBuffer maybeGetResizedBuffer(@Nullable @org.jetbrains.annotations.Nullable int[] input, @Nullable @Nullable ByteBuffer origBuffer) Inspect the input buffer. If it is large enough to encode input, clear and return it, otherwise allocate a new buffer with an appropriate capacity and return that.- Parameters:
input- the input to encodeorigBuffer- the original buffer to maybe resize.- Returns:
- a properly sized byte buffer to encode input.
-
encodeInto
public static void encodeInto(@Nullable @org.jetbrains.annotations.Nullable int[] input, @NotNull @NotNull ByteBuffer byteBuffer) Encode the input values to the specified buffer.- Parameters:
input- the input, may be null.byteBuffer- the buffer to encode into
-
decode
@Nullable public @org.jetbrains.annotations.Nullable int[] decode(@NotNull @NotNull ByteBuffer byteBuffer) Decode a int array from the inputByteBuffer- Specified by:
decodein interfaceio.deephaven.util.codec.ObjectDecoder<int[]>- Parameters:
byteBuffer- the buffer containing the encoded int array- Returns:
- the decoded int array
-
decodeStatic
@Nullable public static @org.jetbrains.annotations.Nullable int[] decodeStatic(@Nullable @Nullable ByteBuffer byteBuffer) -
encode
@NotNull public @org.jetbrains.annotations.NotNull byte[] encode(@Nullable @org.jetbrains.annotations.Nullable int[] input) - Specified by:
encodein interfaceio.deephaven.util.codec.ObjectCodec<int[]>
-
isNullable
public boolean isNullable()- Specified by:
isNullablein interfaceio.deephaven.util.codec.ObjectCodec<int[]>
-
getPrecision
public int getPrecision()- Specified by:
getPrecisionin interfaceio.deephaven.util.codec.ObjectCodec<int[]>
-
getScale
public int getScale()- Specified by:
getScalein interfaceio.deephaven.util.codec.ObjectCodec<int[]>
-
decode
@Nullable public @org.jetbrains.annotations.Nullable int[] decode(@NotNull @org.jetbrains.annotations.NotNull byte[] input, int offset, int length) - Specified by:
decodein interfaceio.deephaven.util.codec.ObjectDecoder<int[]>
-
expectedObjectWidth
public int expectedObjectWidth()- Specified by:
expectedObjectWidthin interfaceio.deephaven.util.codec.ObjectDecoder<int[]>
-