public interface RecordSerde<T>
Modifier and Type | Method and Description |
---|---|
T |
read(org.apache.kafka.common.protocol.Readable input,
int size)
Read a record from a
Readable input. |
int |
recordSize(T data,
org.apache.kafka.common.protocol.ObjectSerializationCache serializationCache)
Get the size of a record.
|
void |
write(T data,
org.apache.kafka.common.protocol.ObjectSerializationCache serializationCache,
org.apache.kafka.common.protocol.Writable out)
Write the record to the output stream.
|
int recordSize(T data, org.apache.kafka.common.protocol.ObjectSerializationCache serializationCache)
write(Object, ObjectSerializationCache, Writable)
.data
- the record that will be serializedserializationCache
- serialization cachevoid write(T data, org.apache.kafka.common.protocol.ObjectSerializationCache serializationCache, org.apache.kafka.common.protocol.Writable out)
recordSize(Object, ObjectSerializationCache)
.
The same ObjectSerializationCache
instance must be used in both calls.data
- the record to serialize and writeserializationCache
- serialization cacheout
- the output stream to write the record toT read(org.apache.kafka.common.protocol.Readable input, int size)
Readable
input.input
- the input stream to deserializesize
- the size of the record in bytes