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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbyte[]serialize(String topic, ByteBuffer data) Convertdatainto a byte array.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.kafka.common.serialization.Serializer
close, configure, serialize
-
Constructor Details
-
ByteBufferSerializer
public ByteBufferSerializer()
-
-
Method Details
-
serialize
Description copied from interface:SerializerConvertdatainto a byte array.- Specified by:
serializein interfaceSerializer<ByteBuffer>- Parameters:
topic- topic associated with datadata- typed data- Returns:
- serialized bytes
-