Package io.deephaven.enterprise.codec
Class StringArrayCodec
java.lang.Object
io.deephaven.enterprise.codec.StringArrayCodec
- All Implemented Interfaces:
io.deephaven.util.codec.ObjectCodec<String[]>,io.deephaven.util.codec.ObjectDecoder<String[]>
- Direct Known Subclasses:
StringArrayCodec
public class StringArrayCodec
extends Object
implements io.deephaven.util.codec.ObjectCodec<String[]>
A codec to read/write String arrays. This is intended for use in loggers, listeners, and the database.
-
Field Summary
Fields inherited from interface io.deephaven.util.codec.ObjectDecoder
VARIABLE_WIDTH_SENTINEL -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@Nullable String[]decode(@org.jetbrains.annotations.NotNull byte[] input, int offset, int length) @Nullable String[]decode(@NotNull ByteBuffer byteBuffer) Decode a String array from the inputByteBufferstatic @Nullable String[]decodeStatic(@NotNull ByteBuffer byteBuffer) Decode a String array from the inputByteBuffer@org.jetbrains.annotations.NotNull byte[]static ByteBufferencodeAndGet(String[] input) Encode the input array into the internal buffer and return it.static voidencodeInto(@Nullable String[] input, @NotNull ByteBuffer byteBuffer) Encode the input values to the specified buffer.intintintgetScale()booleanstatic @NotNull ByteBuffermaybeGetResizedBuffer(@Nullable String[] 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
-
StringArrayCodec
public StringArrayCodec() -
StringArrayCodec
-
-
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 @Nullable String[] 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 @Nullable String[] 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
Decode a String array from the inputByteBuffer- Specified by:
decodein interfaceio.deephaven.util.codec.ObjectDecoder<String[]>- Parameters:
byteBuffer- the buffer containing the encoded String array- Returns:
- the decoded string array
-
decodeStatic
Decode a String array from the inputByteBuffer- Parameters:
byteBuffer- the buffer containing the encoded String array- Returns:
- the decoded string array
-
encode
@NotNull public @org.jetbrains.annotations.NotNull byte[] encode(@Nullable @Nullable String[] input) - Specified by:
encodein interfaceio.deephaven.util.codec.ObjectCodec<String[]>
-
isNullable
public boolean isNullable()- Specified by:
isNullablein interfaceio.deephaven.util.codec.ObjectCodec<String[]>
-
getPrecision
public int getPrecision()- Specified by:
getPrecisionin interfaceio.deephaven.util.codec.ObjectCodec<String[]>
-
getScale
public int getScale()- Specified by:
getScalein interfaceio.deephaven.util.codec.ObjectCodec<String[]>
-
decode
@Nullable public @Nullable String[] decode(@NotNull @org.jetbrains.annotations.NotNull byte[] input, int offset, int length) - Specified by:
decodein interfaceio.deephaven.util.codec.ObjectDecoder<String[]>
-
expectedObjectWidth
public int expectedObjectWidth()- Specified by:
expectedObjectWidthin interfaceio.deephaven.util.codec.ObjectDecoder<String[]>
-