Class ByteBufferSerializer
java.lang.Object
org.apache.kafka.common.serialization.ByteBufferSerializer
- All Implemented Interfaces:
Closeable
,AutoCloseable
,Serializer<ByteBuffer>
Do not need to flip before call serialize(String, ByteBuffer). For example:
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 Summary
-
Method Summary
Modifier and TypeMethodDescriptionbyte[]
serialize
(String topic, ByteBuffer data) Convertdata
into a byte array.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.kafka.common.serialization.Serializer
close, configure, serialize
-
Constructor Details
-
ByteBufferSerializer
public ByteBufferSerializer()
-
-
Method Details
-
serialize
Description copied from interface:Serializer
Convertdata
into a byte array.- Specified by:
serialize
in interfaceSerializer<ByteBuffer>
- Parameters:
topic
- topic associated with datadata
- typed data- Returns:
- serialized bytes
-