public class ByteBufferSerializer extends Object implements Serializer<ByteBuffer>
ByteBufferSerializer serializer = ...; // Create Serializer ByteBuffer buffer = ...; // Allocate ByteBuffer buffer.put(data); // Put data into buffer, do not need to flip serializer.serialize(topic, buffer); // Serialize buffer
Constructor and Description |
---|
ByteBufferSerializer() |
Modifier and Type | Method and Description |
---|---|
byte[] |
serialize(String topic,
ByteBuffer data)
Convert
data into a byte array. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
close, configure, serialize
public byte[] serialize(String topic, ByteBuffer data)
Serializer
data
into a byte array.serialize
in interface Serializer<ByteBuffer>
topic
- topic associated with datadata
- typed data