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
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description T
deserialize(ByteBuffer byteBuf, ColumnDefinition cd)
Same as above but read the data from a ByteBuffer.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 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
serialize(ByteArray array, T v)
default byte[]
toByteArray(T v)
This method serializes the value into a byte array
-
-
-
Method Detail
-
deserialize
T deserialize(ByteArray array, ColumnDefinition cd) throws IOException
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
- Throws:
IOException
-
deserialize
T deserialize(ByteBuffer byteBuf, ColumnDefinition cd) throws IOException
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:
- Throws:
IOException
-
serialize
void serialize(ByteBuffer byteBuf, T v) throws BufferOverflowException
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
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) throws IOException
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
- Throws:
IOException
-
-