Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Class/InterfaceMethod
Serializer
default ByteBuffer serializeToByteBuffer(String topic, T data) {
return wrapNullable(serialize(topic, data));
}

default ByteBuffer serializeToByteBuffer(String topic, Headers headers, T data) {
return wrapNullable(serialize(topic, headers, data));
}
ByteBufferSerializer
/** 
* Note that this method will modify the position and limit of the input ByteBuffer.
*
* @param topic   topic associated with data
* @param data    typed data * @return serialized ByteBuffer
*/
@Override
public ByteBuffer serializeToByteBuffer(String topic, ByteBuffer data) {
if (data == null) {
return null;
}

    // Consider that ByteBuffer#wrap(byte[]) return a ByteBuffer that does not need to call flip().
if (data.position() > 0) {
data.flip();
}
return data;
}

@Override
public ByteBuffer serializeToByteBuffer(String topic, Headers headers, ByteBuffer data) {
return serializeToByteBuffer(topic, data);
}
Partitioner
default int partition(String topic, Object key, ByteBuffer keyBytes, Object value, ByteBuffer valueBytes, Cluster cluster) {
return partition(topic, key, toNullableArray(keyBytes), value, toNullableArray(valueBytes), cluster);
}

Proposed Changes

...