Package org.yamcs.yarch
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 Summary
Modifier and TypeMethodDescriptiondeserialize
(ByteBuffer byteBuf, ColumnDefinition cd) Same as above but read the data from a ByteBuffer.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 theTableDefinition.deserialize(byte[], byte[])
)default T
fromByteArray
(byte[] b, ColumnDefinition cd) this method deserializes the value from a byte arrayvoid
serialize
(ByteBuffer byteBuf, T v) Same as above but serialize into a bytebuffer.void
default byte[]
toByteArray
(T v) This method serializes the value into a byte array
-
Method Details
-
deserialize
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 theTableDefinition.deserialize(byte[], byte[])
)- Parameters:
array
- - array used for the inputcd
- 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
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
- Parameters:
array
-v
-
-
serialize
Same as above but serialize into a bytebuffer. If the ByteBuffer is not large enough, aBufferOverflowException
will be thrown.- Parameters:
byteBuf
-v
-- Throws:
BufferOverflowException
-
toByteArray
This method serializes the value into a byte array- Parameters:
v
-- Returns:
- the resulting byte array
-
fromByteArray
this method deserializes the value from a byte array- Parameters:
b
- the input byte arraycd
- 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
-