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 Modifier and Type Method Description Tdeserialize(DataInputStream stream, 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[]))Tdeserialize(ByteBuffer byteBuf, ColumnDefinition cd)Same as above but read the data from a ByteBuffer.TfromByteArray(byte[] b, ColumnDefinition cd)this method deserializes the value from a byte arrayvoidserialize(DataOutputStream stream, T v)voidserialize(ByteBuffer byteBuf, T v)Same as above but serialize into a bytebuffer.byte[]toByteArray(T v)This method serializes the value into a byte array
-
-
-
Method Detail
-
deserialize
T deserialize(DataInputStream stream, 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:
stream- - data stream 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(DataOutputStream stream, T v) throws IOException
- Parameters:
stream-v-- 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, aBufferOverflowExceptionwill be thrown.- Parameters:
byteBuf-v-- Throws:
BufferOverflowException
-
toByteArray
byte[] toByteArray(T v)
This method serializes the value into a byte array- Parameters:
v-- Returns:
- the resulting byte array
-
fromByteArray
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
-
-