Class ByteArrayCodec

java.lang.Object
io.deephaven.enterprise.codec.ByteArrayCodec
All Implemented Interfaces:
io.deephaven.util.codec.ObjectCodec<byte[]>, io.deephaven.util.codec.ObjectDecoder<byte[]>

public class ByteArrayCodec extends Object implements io.deephaven.util.codec.ObjectCodec<byte[]>
A codec to read/write byte arrays. This codec does not process null values so that any byte[] can be encoded in the minimum number of bytes within the binary log file.
  • Constructor Details

    • ByteArrayCodec

      public ByteArrayCodec()
    • ByteArrayCodec

      public ByteArrayCodec(String[] args)
    • ByteArrayCodec

      public ByteArrayCodec(String args)
  • Method Details

    • encodeAndGet

      public ByteBuffer encodeAndGet(@NotNull @org.jetbrains.annotations.NotNull byte[] input)
      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(@NotNull @org.jetbrains.annotations.NotNull byte[] 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 encode
      origBuffer - the original buffer to maybe resize.
      Returns:
      a properly sized byte buffer to encode input.
    • encodeInto

      public static void encodeInto(@NotNull @org.jetbrains.annotations.NotNull byte[] 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 byte[] decode(@Nullable @Nullable ByteBuffer byteBuffer)
      Decode a byte array from the input ByteBuffer
      Specified by:
      decode in interface io.deephaven.util.codec.ObjectDecoder<byte[]>
      Parameters:
      byteBuffer - the buffer containing the encoded byte array
      Returns:
      the decoded byte array
    • decodeStatic

      @Nullable public static @org.jetbrains.annotations.Nullable byte[] decodeStatic(@Nullable @Nullable ByteBuffer byteBuffer)
    • encode

      @NotNull public @org.jetbrains.annotations.NotNull byte[] encode(@Nullable @org.jetbrains.annotations.Nullable byte[] input)
      Specified by:
      encode in interface io.deephaven.util.codec.ObjectCodec<byte[]>
    • isNullable

      public boolean isNullable()
      Specified by:
      isNullable in interface io.deephaven.util.codec.ObjectCodec<byte[]>
    • getPrecision

      public int getPrecision()
      Specified by:
      getPrecision in interface io.deephaven.util.codec.ObjectCodec<byte[]>
    • getScale

      public int getScale()
      Specified by:
      getScale in interface io.deephaven.util.codec.ObjectCodec<byte[]>
    • decode

      @Nullable public @org.jetbrains.annotations.Nullable byte[] decode(@NotNull @org.jetbrains.annotations.NotNull byte[] input, int offset, int length)
      Specified by:
      decode in interface io.deephaven.util.codec.ObjectDecoder<byte[]>
    • expectedObjectWidth

      public int expectedObjectWidth()
      Specified by:
      expectedObjectWidth in interface io.deephaven.util.codec.ObjectDecoder<byte[]>