Class ByteBufferSerializer

java.lang.Object
org.apache.kafka.common.serialization.ByteBufferSerializer
All Implemented Interfaces:
Closeable, AutoCloseable, Serializer<ByteBuffer>

public class ByteBufferSerializer extends Object implements Serializer<ByteBuffer>
ByteBufferSerializer always rewinds the position of the input buffer to zero for serialization. A manual rewind is not necessary.

Note: any existing buffer position is ignored.

The position is also rewound back to zero before serialize(String, ByteBuffer) returns.

  • Constructor Details

    • ByteBufferSerializer

      public ByteBufferSerializer()
  • Method Details

    • serialize

      public byte[] serialize(String topic, ByteBuffer data)
      Description copied from interface: Serializer
      Convert data into a byte array.
      Specified by:
      serialize in interface Serializer<ByteBuffer>
      Parameters:
      topic - topic associated with data
      data - typed data
      Returns:
      serialized bytes