Class ObjectWithUnitSerializer<U extends org.djunits.unit.Unit<U>,​T>

    • Constructor Detail

      • ObjectWithUnitSerializer

        public ObjectWithUnitSerializer​(byte type,
                                        String dataClassName)
        Construct a new ObjectWithUnitSerializer.
        type - byte; the field type (returned by the fieldType method)
        dataClassName - String; returned by the dataClassName method
    • Method Detail

      • encodeUnit

        protected void encodeUnit​(U unit,
                                  byte[] message,
                                  Pointer pointer,
                                  EndianUtil endianUtil)
        Code a unit, including MoneyUnits.
        unit - U; the unit to code in the byte array
        message - byte[]; the byte array
        pointer - Pointer; the start pointer in the byte array
        endianUtil - EndianUtil; encoder to use for multi-byte values
      • getUnit

        protected U getUnit​(byte[] buffer,
                            Pointer pointer,
                            EndianUtil endianUtil)
        Retrieve and decode a DJUNITS unit.
        buffer - byte[]; the encoded data
        pointer - Pointer; position in the encoded data where the unit is to be decoded from
        endianUtil - EndianUtil; decoder for multi-byte values