Class DoubleVectorArraySerializer<U extends org.djunits.unit.Unit<U>,S extends org.djunits.value.vdouble.scalar.base.DoubleScalar<U,S>,V extends org.djunits.value.vdouble.vector.base.DoubleVector<U,S,V>>
java.lang.Object
org.djutils.serialization.serializers.BasicSerializer<T>
org.djutils.serialization.serializers.ObjectSerializer<T>
org.djutils.serialization.serializers.ObjectWithUnitSerializer<U,V[]>
org.djutils.serialization.serializers.DoubleVectorArraySerializer<U,S,V>
- Type Parameters:
U- the unit typeS- the scalar typeV- the vector type
- All Implemented Interfaces:
Serializer<V[]>
public class DoubleVectorArraySerializer<U extends org.djunits.unit.Unit<U>,S extends org.djunits.value.vdouble.scalar.base.DoubleScalar<U,S>,V extends org.djunits.value.vdouble.vector.base.DoubleVector<U,S,V>>
extends ObjectWithUnitSerializer<U,V[]>
(De)serializes an array of (same length) DJUNITS DoubleVectors.
Copyright (c) 2019-2025 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See DJUNITS License.
- Author:
- Alexander Verbraeck
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionV[]deSerialize(byte[] buffer, Pointer pointer, Endianness endianness) Deserialize an object of type T.intReturn the number of dimensions of the stored data.voidserialize(V[] adva, byte[] buffer, Pointer pointer, Endianness endianness) Serialize an object of type T; not including the prefix byte(s).intCompute 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).Methods inherited from class org.djutils.serialization.serializers.ObjectWithUnitSerializer
encodeUnit, getUnit, hasUnitMethods inherited from class org.djutils.serialization.serializers.ObjectSerializer
serializeWithPrefix, sizeWithPrefixMethods inherited from class org.djutils.serialization.serializers.BasicSerializer
dataClassName, fieldType, toString
-
Constructor Details
-
DoubleVectorArraySerializer
public DoubleVectorArraySerializer()
-
-
Method Details
-
size
Description copied from interface:SerializerCompute 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).- Parameters:
adva- Instance of the object- Returns:
- the number of bytes needed to serialize an object of type T
- Throws:
SerializationException- when theobjectcannot be serialized
-
serialize
public void serialize(V[] adva, byte[] buffer, Pointer pointer, Endianness endianness) throws SerializationException Description copied from interface:SerializerSerialize an object of type T; not including the prefix byte(s).- Parameters:
adva- the object to serializebuffer- buffer for the serialized Tpointer- position in buffer where the first byte of the serialized T will be storedendianness- selects bigEndian or littleEndian encoding- Throws:
SerializationException- when a matrix has size zero or is jagged
-
deSerialize
public V[] deSerialize(byte[] buffer, Pointer pointer, Endianness endianness) throws SerializationException Description copied from interface:SerializerDeserialize an object of type T. Thepointershould be on the first byte of the object; i.e. just after the prefix byte.- Parameters:
buffer- the bytes with serialized data that must be reconstructed into a Tpointer- position in the buffer where the first byte of the serialized T is locatedendianness- selects bigEndian or littleEndian encoding- Returns:
- a T object constructed from the data in the buffer
- Throws:
SerializationException- when the input data cannot be deserialized
-
getNumberOfDimensions
public int getNumberOfDimensions()Description copied from interface:SerializerReturn the number of dimensions of the stored data.- Specified by:
getNumberOfDimensionsin interfaceSerializer<U extends org.djunits.unit.Unit<U>>- Overrides:
getNumberOfDimensionsin classObjectSerializer<V extends org.djunits.value.vdouble.vector.base.DoubleVector<U,S, V>[]> - Returns:
- 0 for plain data, 1 for array, 2 for matrix
-