public class ItemName extends Object implements Serializer<String>
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 |
---|
ItemName(byte[] buffer,
Pointer pointer)
Construct a new ItemName from serialized data.
|
ItemName(String string)
Construct a new ItemName.
|
Modifier and Type | Method and Description |
---|---|
String |
dataClassName()
Return a description of the type of data that this serializer handles.
|
String |
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(String object,
byte[] buffer,
Pointer pointer,
EndianUtil endianUtil)
Serialize an object of type T; not including the prefix byte(s).
|
void |
serializeWithPrefix(String object,
byte[] buffer,
Pointer pointer,
EndianUtil endianUtil)
Serialize an object of type T including the prefix byte(s).
|
int |
size(String 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(String 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).
|
public ItemName(String string) throws SerializationException
string
- String; name of the itemSerializationException
- when the string
is too long, or contains illegal characterspublic ItemName(byte[] buffer, Pointer pointer)
buffer
- byte[]; the datapointer
- Pointer; position in the datapublic int size(String object) throws SerializationException
size
in interface Serializer<String>
object
- Object; Instance of the object (should be of type T)SerializationException
- when the object
cannot be serializedpublic int sizeWithPrefix(String object) throws SerializationException
sizeWithPrefix
in interface Serializer<String>
object
- Instance of the object (should be instance of T)SerializationException
- when the object
cannot be serializedpublic byte fieldType()
fieldType
in interface Serializer<String>
public void serialize(String object, byte[] buffer, Pointer pointer, EndianUtil endianUtil) throws SerializationException
serialize
in interface Serializer<String>
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 void serializeWithPrefix(String object, byte[] buffer, Pointer pointer, EndianUtil endianUtil) throws SerializationException
serializeWithPrefix
in interface Serializer<String>
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 String deSerialize(byte[] buffer, Pointer pointer, EndianUtil endianUtil)
pointer
should be on the first byte of the object; i.e. just after the
prefix byte.deSerialize
in interface Serializer<String>
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 encodingpublic String dataClassName()
dataClassName
in interface Serializer<String>
public final int getNumberOfDimensions()
Serializer
getNumberOfDimensions
in interface Serializer<String>
Copyright © 2018–2019 Delft University of Technology. All rights reserved.