Class EventSerializer<E extends org.djutils.event.Event>

java.lang.Object
org.opentrafficsim.sim0mq.publisher.EventSerializer<E>
Type Parameters:
E - event type
All Implemented Interfaces:
org.djutils.serialization.serializers.Serializer<org.djutils.event.Event>

public class EventSerializer<E extends org.djutils.event.Event> extends Object implements org.djutils.serialization.serializers.Serializer<org.djutils.event.Event>
Convert one Event into an equivalent Sim0MQ Message, or back.

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

Author:
Alexander Verbraeck, Peter Knoppers, Wouter Schakel
  • Constructor Summary

    Constructors
    Constructor
    Description
    EventSerializer(org.djutils.event.EventType eventType)
    Construct a new EventSerializer for the specified EventType.
  • Method Summary

    Modifier and Type
    Method
    Description
    org.djutils.event.Event
    deSerialize(byte[] buffer, org.djutils.serialization.serializers.Pointer pointer, org.djutils.serialization.EndianUtil endianUtil)
    byte
    final int
    void
    serialize(org.djutils.event.Event object, byte[] buffer, org.djutils.serialization.serializers.Pointer pointer, org.djutils.serialization.EndianUtil endianUtil)
    void
    serializeWithPrefix(org.djutils.event.Event object, byte[] buffer, org.djutils.serialization.serializers.Pointer pointer, org.djutils.serialization.EndianUtil endianUtil)
    int
    size(org.djutils.event.Event event)
    int
    sizeWithPrefix(org.djutils.event.Event event)

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • EventSerializer

      EventSerializer(org.djutils.event.EventType eventType)
      Construct a new EventSerializer for the specified EventType.
      Parameters:
      eventType - EventType; the event type
  • Method Details

    • size

      public int size(org.djutils.event.Event event) throws org.djutils.serialization.SerializationException
      Specified by:
      size in interface org.djutils.serialization.serializers.Serializer<E extends org.djutils.event.Event>
      Throws:
      org.djutils.serialization.SerializationException
    • sizeWithPrefix

      public int sizeWithPrefix(org.djutils.event.Event event) throws org.djutils.serialization.SerializationException
      Specified by:
      sizeWithPrefix in interface org.djutils.serialization.serializers.Serializer<E extends org.djutils.event.Event>
      Throws:
      org.djutils.serialization.SerializationException
    • fieldType

      public byte fieldType()
      Specified by:
      fieldType in interface org.djutils.serialization.serializers.Serializer<E extends org.djutils.event.Event>
    • serialize

      public void serialize(org.djutils.event.Event object, byte[] buffer, org.djutils.serialization.serializers.Pointer pointer, org.djutils.serialization.EndianUtil endianUtil) throws org.djutils.serialization.SerializationException
      Specified by:
      serialize in interface org.djutils.serialization.serializers.Serializer<E extends org.djutils.event.Event>
      Throws:
      org.djutils.serialization.SerializationException
    • serializeWithPrefix

      public void serializeWithPrefix(org.djutils.event.Event object, byte[] buffer, org.djutils.serialization.serializers.Pointer pointer, org.djutils.serialization.EndianUtil endianUtil) throws org.djutils.serialization.SerializationException
      Specified by:
      serializeWithPrefix in interface org.djutils.serialization.serializers.Serializer<E extends org.djutils.event.Event>
      Throws:
      org.djutils.serialization.SerializationException
    • deSerialize

      public org.djutils.event.Event deSerialize(byte[] buffer, org.djutils.serialization.serializers.Pointer pointer, org.djutils.serialization.EndianUtil endianUtil) throws org.djutils.serialization.SerializationException
      Specified by:
      deSerialize in interface org.djutils.serialization.serializers.Serializer<E extends org.djutils.event.Event>
      Throws:
      org.djutils.serialization.SerializationException
    • dataClassName

      public String dataClassName()
      Specified by:
      dataClassName in interface org.djutils.serialization.serializers.Serializer<E extends org.djutils.event.Event>
    • getNumberOfDimensions

      public final int getNumberOfDimensions()
      Specified by:
      getNumberOfDimensions in interface org.djutils.serialization.serializers.Serializer<E extends org.djutils.event.Event>