Class BytesSerializer

java.lang.Object
org.apache.kafka.common.serialization.BytesSerializer
All Implemented Interfaces:
Closeable, AutoCloseable, Serializer<org.apache.kafka.common.utils.Bytes>

public class BytesSerializer extends Object implements Serializer<org.apache.kafka.common.utils.Bytes>
  • Constructor Details

    • BytesSerializer

      public BytesSerializer()
  • Method Details

    • serialize

      public byte[] serialize(String topic, org.apache.kafka.common.utils.Bytes data)
      Description copied from interface: Serializer
      Convert data into a byte array.

      It is recommended to serialize null data to the null byte array.

      Specified by:
      serialize in interface Serializer<org.apache.kafka.common.utils.Bytes>
      Parameters:
      topic - topic associated with data
      data - typed data; may be null
      Returns:
      serialized bytes; may be null