Class FixedSizeObjectSerializer<T>

  • Type Parameters:
    T - class
    All Implemented Interfaces:
    Serializer<T>

    public abstract class FixedSizeObjectSerializer<T>
    extends ObjectSerializer<T>
    Serializer for simple, fixed size, classes.

    Copyright (c) 2019-2023 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
    BSD-style license. See DJUTILS License.

    Version:
    $Revision$, $LastChangedDate$, by $Author$,
    Author:
    Alexander Verbraeck, Peter Knoppers
    • Constructor Detail

      • FixedSizeObjectSerializer

        public FixedSizeObjectSerializer​(byte fieldType,
                                         int serializedDataSize,
                                         String dataClassName)
        Construct the FixedSizeSerializer.
        Parameters:
        fieldType - byte; the field type (returned by the fieldType method)
        serializedDataSize - int; number of bytes required for serialized T
        dataClassName - String; returned by the dataClassName method
    • Method Detail

      • size

        public final int size​(Object object)
        Description copied from interface: Serializer
        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:
        object - T; Instance of the object
        Returns:
        int; the number of bytes needed to serialize an object of type T