Class DefaultSerializer

java.lang.Object
com.linkedin.venice.serialization.DefaultSerializer
All Implemented Interfaces:
VeniceKafkaSerializer<byte[]>, Closeable, AutoCloseable, org.apache.kafka.common.serialization.Deserializer<byte[]>, org.apache.kafka.common.serialization.Serializer<byte[]>

public class DefaultSerializer extends Object implements VeniceKafkaSerializer<byte[]>
Default Kafka VeniceKafkaSerializer
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Close this serializer.
    void
    configure(Map<String,?> configMap, boolean isKey)
    Configure this class.
    byte[]
    deserialize(String topic, byte[] bytes)
    Create an object from an array of bytes
    byte[]
    serialize(String topic, byte[] bytes)
    Construct an array of bytes from the given object

    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.Deserializer

    deserialize

    Methods inherited from interface org.apache.kafka.common.serialization.Serializer

    serialize
  • Constructor Details

    • DefaultSerializer

      public DefaultSerializer()
  • Method Details

    • close

      public void close()
      Description copied from interface: VeniceKafkaSerializer
      Close this serializer. This method has to be idempotent if the serializer is used in KafkaProducer because it might be called multiple times.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Specified by:
      close in interface org.apache.kafka.common.serialization.Deserializer<byte[]>
      Specified by:
      close in interface org.apache.kafka.common.serialization.Serializer<byte[]>
      Specified by:
      close in interface VeniceKafkaSerializer<byte[]>
    • configure

      public void configure(Map<String,?> configMap, boolean isKey)
      Description copied from interface: VeniceKafkaSerializer
      Configure this class.
      Specified by:
      configure in interface org.apache.kafka.common.serialization.Deserializer<byte[]>
      Specified by:
      configure in interface org.apache.kafka.common.serialization.Serializer<byte[]>
      Specified by:
      configure in interface VeniceKafkaSerializer<byte[]>
      Parameters:
      configMap - configs in key/value pairs
      isKey - whether is for key or value
    • serialize

      public byte[] serialize(String topic, byte[] bytes)
      Description copied from interface: VeniceKafkaSerializer
      Construct an array of bytes from the given object
      Specified by:
      serialize in interface org.apache.kafka.common.serialization.Serializer<byte[]>
      Specified by:
      serialize in interface VeniceKafkaSerializer<byte[]>
      Parameters:
      topic - Topic to which the object belongs.
      bytes - The object
      Returns:
      The bytes taken from the object
    • deserialize

      public byte[] deserialize(String topic, byte[] bytes)
      Description copied from interface: VeniceKafkaSerializer
      Create an object from an array of bytes
      Specified by:
      deserialize in interface org.apache.kafka.common.serialization.Deserializer<byte[]>
      Specified by:
      deserialize in interface VeniceKafkaSerializer<byte[]>
      Parameters:
      topic - Topic to which the array of bytes belongs.
      bytes - An array of bytes with the objects data
      Returns:
      A java object serialzed from the bytes