use of org.apache.kafka.common.protocol.ObjectSerializationCache in project kafka by apache.
the class BytesApiMessageSerde method serialize.
public byte[] serialize(ApiMessageAndVersion messageAndVersion) {
ObjectSerializationCache cache = new ObjectSerializationCache();
int size = apiMessageSerde.recordSize(messageAndVersion, cache);
ByteBufferAccessor writable = new ByteBufferAccessor(ByteBuffer.allocate(size));
apiMessageSerde.write(messageAndVersion, cache, writable);
return writable.buffer().array();
}
Aggregations