Class StringMatrixSerializer

java.lang.Object
org.djutils.serialization.serializers.BasicSerializer<String[][]>
org.djutils.serialization.serializers.StringMatrixSerializer
All Implemented Interfaces:
Serializer<String[][]>

public abstract class StringMatrixSerializer extends BasicSerializer<String[][]>
StringMatrixSerializer contains the basic methods to (de)serialize a String matrix..

Copyright (c) 2023-2025 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. See for project information https://djutils.org. The DJUTILS project is distributed under a three-clause BSD-style license, which can be found at https://djutils.org/docs/license.html.

Author:
Alexander Verbraeck
  • Constructor Details

    • StringMatrixSerializer

      public StringMatrixSerializer(byte type, String dataClassName)
      Construct the StringArraySerializer.
      Parameters:
      type - the field type (returned by the fieldType method)
      dataClassName - returned by the dataClassName method
  • Method Details

    • sizeWithPrefix

      public final int sizeWithPrefix(String[][] object) throws SerializationException
      Description copied from interface: Serializer
      Compute the number of bytes needed to serialize an object of type T (including the byte(s) that indicate that an object of type T is next in the data stream).
      Parameters:
      object - Instance of the object
      Returns:
      the number of bytes needed to serialize an object of type T
      Throws:
      SerializationException - when the object cannot be serialized
    • serializeWithPrefix

      public final void serializeWithPrefix(String[][] object, byte[] buffer, Pointer pointer, EndianUtil endianUtil) throws SerializationException
      Description copied from interface: Serializer
      Serialize an object of type T including the prefix byte(s).
      Parameters:
      object - the object to serialize
      buffer - buffer for the serialized T
      pointer - position in buffer where the first byte of the serialized T will be stored
      endianUtil - selects bigEndian or littleEndian encoding
      Throws:
      SerializationException - when a matrix has size zero or is jagged
    • getNumberOfDimensions

      public final int getNumberOfDimensions()
      Description copied from interface: Serializer
      Return the number of dimensions of the stored data.
      Returns:
      0 for plain data, 1 for array, 2 for matrix