Package io.pravega.client.stream
Interface Serializer<T>
-
- Type Parameters:
T
- The type of event that this serializes.
- All Known Implementing Classes:
WatermarkSerializer
public interface Serializer<T>
Takes events being written and serializes them to byteBuffers so they can be sent over the wire and deserializes these same byte buffers back into objects.NOTE: There is no need for implementations to implement any sort of "framing"; the byte buffers passed to deserialize will be of the appropriate length.
-
-
Field Summary
Fields Modifier and Type Field Description static int
MAX_EVENT_SIZE
The maximum event size, in bytes.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description T
deserialize(java.nio.ByteBuffer serializedValue)
Deserializes the given ByteBuffer into an event.java.nio.ByteBuffer
serialize(T value)
Serializes the given event.
-
-
-
Field Detail
-
MAX_EVENT_SIZE
static final int MAX_EVENT_SIZE
The maximum event size, in bytes.- See Also:
- Constant Field Values
-
-
Method Detail
-
serialize
java.nio.ByteBuffer serialize(T value)
Serializes the given event.- Parameters:
value
- The event to be serialized.- Returns:
- The serialized form of the event.
NOTE: buffers returned should not exceed
MAX_EVENT_SIZE
.
-
deserialize
T deserialize(java.nio.ByteBuffer serializedValue)
Deserializes the given ByteBuffer into an event.- Parameters:
serializedValue
- A event that has been previously serialized.- Returns:
- The event object.
-
-