Class StringSerializer

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

public class StringSerializer extends Object implements VeniceKafkaSerializer<String>
  • 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.
    deserialize(String topic, byte[] byteArray)
    Create an object from an array of bytes
    byte[]
    serialize(String topic, String string)
    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

    • StringSerializer

      public StringSerializer()
  • Method Details

    • deserialize

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

      public void close()
      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<String>
      Specified by:
      close in interface org.apache.kafka.common.serialization.Serializer<String>
      Specified by:
      close in interface VeniceKafkaSerializer<String>
    • configure

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

      public byte[] serialize(String topic, String string)
      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<String>
      Specified by:
      serialize in interface VeniceKafkaSerializer<String>
      Parameters:
      topic - Topic to which the object belongs.
      string - The object
      Returns:
      The bytes taken from the object