Interface ColumnSerializer<T>

Type Parameters:
T -
All Known Implementing Classes:
ParameterValueColumnSerializer

public interface ColumnSerializer<T>
Serializes column values to byte arrays (used as part of tables) and back
  • Method Details

    • deserialize

      T deserialize(ByteArray array, ColumnDefinition cd)
      Read one column value (i.e. a cell from the stream) The enums are deserialized as shorts (it is converted to the actual type in the TableDefinition.deserialize(byte[], byte[]))
      Parameters:
      array - - array used for the input
      cd - the column definition for the involved column (can be used to look up column name or other properties to help in deserialization)
      Returns:
      the deserialized value
    • deserialize

      T deserialize(ByteBuffer byteBuf, ColumnDefinition cd)
      Same as above but read the data from a ByteBuffer.

      If the buffer is not long enough, it throws an BufferUnderflowException.

      Parameters:
      byteBuf -
      cd -
      Returns:
    • serialize

      void serialize(ByteArray array, T v)
      Parameters:
      array -
      v -
    • serialize

      void serialize(ByteBuffer byteBuf, T v) throws BufferOverflowException
      Same as above but serialize into a bytebuffer. If the ByteBuffer is not large enough, a BufferOverflowException will be thrown.
      Parameters:
      byteBuf -
      v -
      Throws:
      BufferOverflowException
    • toByteArray

      default byte[] toByteArray(T v)
      This method serializes the value into a byte array
      Parameters:
      v -
      Returns:
      the resulting byte array
    • fromByteArray

      default T fromByteArray(byte[] b, ColumnDefinition cd)
      this method deserializes the value from a byte array
      Parameters:
      b - the input byte array
      cd - the column definition for the involved column (can be used to look up column name or other properties to help in deserialization)
      Returns:
      the deserialized value