Package elki.utilities.io
Interface ByteBufferSerializer<T>
-
- Type Parameters:
T
- Object type processed
- All Known Subinterfaces:
FixedSizeByteBufferSerializer<T>
- All Known Implementing Classes:
BitVector.ShortSerializer
,ByteArrayUtil.ByteSerializer
,ByteArrayUtil.DoubleSerializer
,ByteArrayUtil.FloatSerializer
,ByteArrayUtil.IntegerSerializer
,ByteArrayUtil.LongSerializer
,ByteArrayUtil.ShortSerializer
,ByteArrayUtil.StringSerializer
,ByteArrayUtil.VarintSerializer
,ByteVector.ShortSerializer
,ByteVector.SmallSerializer
,DoubleVector.ShortSerializer
,DoubleVector.SmallSerializer
,DoubleVector.VariableSerializer
,FloatVector.ShortSerializer
,FloatVector.SmallSerializer
,FloatVector.VariableSerializer
,IntegerDBID.DynamicSerializer
,IntegerDBID.StaticSerializer
,IntegerVector.ShortSerializer
,IntegerVector.SmallSerializer
,IntegerVector.VariableSerializer
,LabelList.Serializer
,ShortVector.ShortSerializer
,ShortVector.VariableSerializer
,SimpleClassLabel.Serializer
,SparseByteVector.VariableSerializer
,SparseDoubleVector.VariableSerializer
,SparseFloatVector.VariableSerializer
,SparseIntegerVector.VariableSerializer
,SparseShortVector.VariableSerializer
,TypeInformationSerializer
,TypeInformationSerializer.SimpleTypeSerializer
,TypeInformationSerializer.VectorFieldTypeSerializer
,TypeInformationSerializer.VectorTypeSerializer
public interface ByteBufferSerializer<T>
Class to convert from and to byte arrays (in index structures).- Since:
- 0.4.0
- Author:
- Erich Schubert
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description T
fromByteBuffer(java.nio.ByteBuffer buffer)
Deserialize an object from a byte buffer (e.g., disk)int
getByteSize(T object)
Get the size of the object in bytes.void
toByteBuffer(java.nio.ByteBuffer buffer, T object)
Serialize the object to a byte array (e.g., disk)
-
-
-
Method Detail
-
fromByteBuffer
T fromByteBuffer(java.nio.ByteBuffer buffer) throws java.io.IOException
Deserialize an object from a byte buffer (e.g., disk)- Parameters:
buffer
- Data array to process- Returns:
- Deserialized object
- Throws:
java.io.IOException
- on IO errorsjava.lang.UnsupportedOperationException
- When functionality not implemented or available
-
toByteBuffer
void toByteBuffer(java.nio.ByteBuffer buffer, T object) throws java.io.IOException
Serialize the object to a byte array (e.g., disk)- Parameters:
buffer
- Buffer to serialize toobject
- Object to serialize- Throws:
java.io.IOException
- on IO errorsjava.lang.UnsupportedOperationException
- When functionality not implemented or available
-
getByteSize
int getByteSize(T object) throws java.io.IOException
Get the size of the object in bytes.- Parameters:
object
- Object to serialize- Returns:
- maximum size in serialized form
- Throws:
java.io.IOException
- on IO errorsjava.lang.UnsupportedOperationException
- When functionality not implemented or available
-
-