Class DefaultSerializer
- java.lang.Object
-
- com.linkedin.venice.serialization.DefaultSerializer
-
- All Implemented Interfaces:
VeniceKafkaSerializer<byte[]>
,java.io.Closeable
,java.lang.AutoCloseable
,org.apache.kafka.common.serialization.Deserializer<byte[]>
,org.apache.kafka.common.serialization.Serializer<byte[]>
public class DefaultSerializer extends java.lang.Object implements VeniceKafkaSerializer<byte[]>
Default Kafka VeniceKafkaSerializer
-
-
Constructor Summary
Constructors Constructor Description DefaultSerializer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Close this serializer.void
configure(java.util.Map<java.lang.String,?> configMap, boolean isKey)
Configure this class.byte[]
deserialize(java.lang.String topic, byte[] bytes)
Create an object from an array of bytesbyte[]
serialize(java.lang.String topic, byte[] bytes)
Construct an array of bytes from the given object
-
-
-
Method Detail
-
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 interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Specified by:
close
in interfaceorg.apache.kafka.common.serialization.Deserializer<byte[]>
- Specified by:
close
in interfaceorg.apache.kafka.common.serialization.Serializer<byte[]>
- Specified by:
close
in interfaceVeniceKafkaSerializer<byte[]>
-
configure
public void configure(java.util.Map<java.lang.String,?> configMap, boolean isKey)
Description copied from interface:VeniceKafkaSerializer
Configure this class.- Specified by:
configure
in interfaceorg.apache.kafka.common.serialization.Deserializer<byte[]>
- Specified by:
configure
in interfaceorg.apache.kafka.common.serialization.Serializer<byte[]>
- Specified by:
configure
in interfaceVeniceKafkaSerializer<byte[]>
- Parameters:
configMap
- configs in key/value pairsisKey
- whether is for key or value
-
serialize
public byte[] serialize(java.lang.String topic, byte[] bytes)
Description copied from interface:VeniceKafkaSerializer
Construct an array of bytes from the given object- Specified by:
serialize
in interfaceorg.apache.kafka.common.serialization.Serializer<byte[]>
- Specified by:
serialize
in interfaceVeniceKafkaSerializer<byte[]>
- Parameters:
topic
- Topic to which the object belongs.bytes
- The object- Returns:
- The bytes taken from the object
-
deserialize
public byte[] deserialize(java.lang.String topic, byte[] bytes)
Description copied from interface:VeniceKafkaSerializer
Create an object from an array of bytes- Specified by:
deserialize
in interfaceorg.apache.kafka.common.serialization.Deserializer<byte[]>
- Specified by:
deserialize
in interfaceVeniceKafkaSerializer<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
-
-