T - Type of object that can be serialized and deserializedpublic interface Serializer<T>
Copyright (c) 2019-2019 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
version Jun 07, 2019
| Modifier and Type | Method and Description |
|---|---|
String |
dataClassName()
Return a description of the type of data that this serializer handles.
|
T |
deSerialize(byte[] buffer,
Pointer pointer,
EndianUtil endianUtil)
Deserialize an object of type T.
|
byte |
fieldType()
Return the byte representation of the field type.
|
int |
getNumberOfDimensions()
Return the number of dimensions of the stored data.
|
void |
serialize(T object,
byte[] buffer,
Pointer pointer,
EndianUtil endianUtil)
Serialize an object of type T; not including the prefix byte(s).
|
void |
serializeWithPrefix(T object,
byte[] buffer,
Pointer pointer,
EndianUtil endianUtil)
Serialize an object of type T including the prefix byte(s).
|
int |
size(T object)
Compute the number of bytes needed to serialize an object of type T (excluding the byte(s) that indicate that an object
of type T is next in the data stream).
|
int |
sizeWithPrefix(T object)
Compute the number of bytes needed to serialize an object of type T (including the byte(s) that indicate that an object
of type T is next in the data stream).
|
int size(T object) throws SerializationException
object - T; Instance of the objectSerializationException - when the object cannot be serializedint sizeWithPrefix(T object) throws SerializationException
object - T; Instance of the objectSerializationException - when the object cannot be serializedbyte fieldType()
void serialize(T object, byte[] buffer, Pointer pointer, EndianUtil endianUtil) throws SerializationException
object - T; the object to serializebuffer - byte[]; buffer for the serialized Tpointer - Pointer; position in buffer where the first byte of the serialized T will be storedendianUtil - EndianUtil; selects bigEndian or littleEndian encodingSerializationException - when a matrix has size zero or is jaggedvoid serializeWithPrefix(T object, byte[] buffer, Pointer pointer, EndianUtil endianUtil) throws SerializationException
object - T; the object to serializebuffer - byte[]; buffer for the serialized Tpointer - Pointer; position in buffer where the first byte of the serialized T will be storedendianUtil - EndianUtil; selects bigEndian or littleEndian encodingSerializationException - when a matrix has size zero or is jaggedT deSerialize(byte[] buffer, Pointer pointer, EndianUtil endianUtil) throws SerializationException
pointer should be on the first byte of the object; i.e. just after the
prefix byte.buffer - byte[]; the bytes with serialized data that must be reconstructed into a Tpointer - Pointer; position in the buffer where the first byte of the serialized T is locatedendianUtil - EndianUtil; selects bigEndian or littleEndian encodingSerializationException - when the input data cannot be deserializedString dataClassName()
int getNumberOfDimensions()
Copyright © 2018–2019 Delft University of Technology. All rights reserved.