Class TimeWindowAdapter
java.lang.Object
com.inductiveautomation.historian.common.rpc.adapters.query.TimeWindowAdapter
- All Implemented Interfaces:
BinaryAdapter<TimeWindow>,BinaryDeserializer<TimeWindow>,BinarySerializer<TimeWindow>
A binary adapter for serializing and deserializing
TimeWindow objects.
This class provides methods to encode a TimeWindow into a byte array
and decode a byte array back into a TimeWindow. It uses Protocol Buffers
for serialization and deserialization.
-
Method Summary
Modifier and TypeMethodDescriptiondecode(byte[] serialized, DeserializationContext context) Decodes a byte array into aTimeWindowobject.byte[]encode(TimeWindow any, SerializationContext context) Encodes aTimeWindowobject into a byte array.static TimeWindowAdapterRetrieves the singleton instance of theTimeWindowAdapter.
-
Method Details
-
getInstance
Retrieves the singleton instance of theTimeWindowAdapter.- Returns:
- The singleton instance of
TimeWindowAdapter.
-
decode
public TimeWindow decode(byte[] serialized, DeserializationContext context) throws ProtoSerializationException Decodes a byte array into aTimeWindowobject.- Specified by:
decodein interfaceBinaryDeserializer<TimeWindow>- Parameters:
serialized- The byte array containing the serializedTimeWindow.context- TheDeserializationContextfor the operation.- Returns:
- The deserialized
TimeWindowobject. - Throws:
ProtoSerializationException- If an error occurs during deserialization.
-
encode
public byte[] encode(TimeWindow any, SerializationContext context) throws ProtoSerializationException Encodes aTimeWindowobject into a byte array.- Specified by:
encodein interfaceBinarySerializer<TimeWindow>- Parameters:
any- TheTimeWindowobject to encode.context- TheSerializationContextfor the operation.- Returns:
- A byte array representing the serialized
TimeWindow. - Throws:
ProtoSerializationException- If an error occurs during serialization.
-