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
ConstructorDescriptionEventSerializer
(org.djutils.event.EventType eventType) Construct a new EventSerializer for the specifiedEventType
. -
Method Summary
Modifier and TypeMethodDescriptionorg.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)
-
Constructor Details
-
EventSerializer
EventSerializer(org.djutils.event.EventType eventType) Construct a new EventSerializer for the specifiedEventType
.- 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 interfaceorg.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 interfaceorg.djutils.serialization.serializers.Serializer<E extends org.djutils.event.Event>
- Throws:
org.djutils.serialization.SerializationException
-
fieldType
public byte fieldType()- Specified by:
fieldType
in interfaceorg.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 interfaceorg.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 interfaceorg.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 interfaceorg.djutils.serialization.serializers.Serializer<E extends org.djutils.event.Event>
- Throws:
org.djutils.serialization.SerializationException
-
dataClassName
- Specified by:
dataClassName
in interfaceorg.djutils.serialization.serializers.Serializer<E extends org.djutils.event.Event>
-
getNumberOfDimensions
public final int getNumberOfDimensions()- Specified by:
getNumberOfDimensions
in interfaceorg.djutils.serialization.serializers.Serializer<E extends org.djutils.event.Event>
-