U
- the unit typeT
- the object typepublic abstract class ObjectWithUnitSerializer<U extends org.djunits.unit.Unit<U>,T> extends ObjectSerializer<T>
Copyright (c) 2019-2019 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See DJUNITS License.
Constructor and Description |
---|
ObjectWithUnitSerializer(byte type,
String dataClassName)
Construct a new ObjectWithUnitSerializer.
|
Modifier and Type | Method and Description |
---|---|
protected void |
encodeUnit(U unit,
byte[] message,
Pointer pointer,
EndianUtil endianUtil)
Code a unit, including MoneyUnits.
|
protected U |
getUnit(byte[] buffer,
Pointer pointer,
EndianUtil endianUtil)
Retrieve and decode a DJUNITS unit.
|
getNumberOfDimensions, serializeWithPrefix, sizeWithPrefix
dataClassName, fieldType, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
deSerialize, serialize, size
public ObjectWithUnitSerializer(byte type, String dataClassName)
type
- byte; the field type (returned by the fieldType
method)dataClassName
- String; returned by the dataClassName methodprotected void encodeUnit(U unit, byte[] message, Pointer pointer, EndianUtil endianUtil)
unit
- the unit to code in the byte arraymessage
- the byte arraypointer
- the start pointer in the byte arrayendianUtil
- EndianUtil; encoder to use for multi-byte valuesprotected U getUnit(byte[] buffer, Pointer pointer, EndianUtil endianUtil)
buffer
- byte[]; the encoded datapointer
- Pointer; position in the encoded data where the unit is to be decoded fromendianUtil
- EndianUtil; decoder for multi-byte valuesCopyright © 2018–2019 Delft University of Technology. All rights reserved.