Class FloatScalarSerializer<U extends org.djunits.unit.Unit<U>,S extends org.djunits.value.vfloat.scalar.base.FloatScalarInterface<U,S>>
java.lang.Object
org.djutils.serialization.serializers.BasicSerializer<T>
org.djutils.serialization.serializers.ObjectSerializer<T>
org.djutils.serialization.serializers.ObjectWithUnitSerializer<U,S>
org.djutils.serialization.serializers.FloatScalarSerializer<U,S>
- Type Parameters:
 U- the unit typeS- the scalar type
- All Implemented Interfaces:
 Serializer<S>
public class FloatScalarSerializer<U extends org.djunits.unit.Unit<U>,S extends org.djunits.value.vfloat.scalar.base.FloatScalarInterface<U,S>> extends ObjectWithUnitSerializer<U,S>
(De)serializes a DJUNITS FloatScalar.
 
 Copyright (c) 2019-2020 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 Constructor Description FloatScalarSerializer() - 
Method Summary
Modifier and Type Method Description SdeSerialize(byte[] buffer, Pointer pointer, EndianUtil endianUtil)Deserialize an object of type T.voidserialize(S afs, byte[] buffer, Pointer pointer, EndianUtil endianUtil)Serialize an object of type T; not including the prefix byte(s).intsize(S afs)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).Methods inherited from class org.djutils.serialization.serializers.ObjectWithUnitSerializer
encodeUnit, getUnitMethods inherited from class org.djutils.serialization.serializers.ObjectSerializer
getNumberOfDimensions, serializeWithPrefix, sizeWithPrefixMethods inherited from class org.djutils.serialization.serializers.BasicSerializer
dataClassName, fieldType, toString 
- 
Constructor Details
- 
FloatScalarSerializer
public FloatScalarSerializer() 
 - 
 - 
Method Details
- 
size
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).- Parameters:
 afs- T; Instance of the object- Returns:
 - int; the number of bytes needed to serialize an object of type T
 - Throws:
 SerializationException- when theobjectcannot be serialized
 - 
serialize
public void serialize(S afs, byte[] buffer, Pointer pointer, EndianUtil endianUtil) throws SerializationExceptionSerialize an object of type T; not including the prefix byte(s).- Parameters:
 afs- 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 encoding- Throws:
 SerializationException- when a matrix has size zero or is jagged
 - 
deSerialize
public S deSerialize(byte[] buffer, Pointer pointer, EndianUtil endianUtil) throws SerializationExceptionDeserialize an object of type T. Thepointershould be on the first byte of the object; i.e. just after the prefix byte.- Parameters:
 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 encoding- Returns:
 - T; a T object constructed from the data in the buffer
 - Throws:
 SerializationException- when the input data cannot be deserialized
 
 -