T
- classpublic abstract class ObjectSerializer<T> extends BasicSerializer<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.
Constructor and Description |
---|
ObjectSerializer(byte type,
String dataClassName)
Construct a new ObjectSerializer.
|
Modifier and Type | Method and Description |
---|---|
int |
getNumberOfDimensions()
Return the number of dimensions of the stored data.
|
void |
serializeWithPrefix(T object,
byte[] buffer,
Pointer pointer,
EndianUtil endianUtil)
Serialize an object of type T including the prefix byte(s).
|
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).
|
dataClassName, fieldType, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
deSerialize, serialize, size
public ObjectSerializer(byte type, String dataClassName)
type
- byte; the field type (returned by the fieldType
method)dataClassName
- String; returned by the dataClassName methodpublic final int sizeWithPrefix(T object) throws SerializationException
Serializer
object
- Instance of the object (should be instance of T)SerializationException
- when the object
cannot be serializedpublic final void serializeWithPrefix(T object, byte[] buffer, Pointer pointer, EndianUtil endianUtil) throws SerializationException
Serializer
object
- Object; the object to serialize (should be of type T)buffer
- 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 jaggedpublic final int getNumberOfDimensions()
Serializer
Copyright © 2018–2019 Delft University of Technology. All rights reserved.