diff --git a/clients/src/main/java/org/apache/kafka/common/serialization/Deserializer.java b/clients/src/main/java/org/apache/kafka/common/serialization/Deserializer.java index cf24d858e5865..e03287843c35d 100644 --- a/clients/src/main/java/org/apache/kafka/common/serialization/Deserializer.java +++ b/clients/src/main/java/org/apache/kafka/common/serialization/Deserializer.java @@ -97,6 +97,12 @@ default T deserialize(String topic, Headers headers, byte[] data) { *
Similarly, if this method is overridden, the implementation cannot make any assumptions about the * passed in {@link ByteBuffer} either. * + *
The serialized bytes are the buffer's {@link ByteBuffer#remaining() remaining} bytes, i.e. those + * between its current {@code position} and {@code limit}. An implementation should read the data without + * changing the buffer's {@code position}, {@code limit}, or {@code mark}: the caller retains ownership of + * the buffer and may read it again after this method returns (for example, to determine the serialized + * size of the value), so mutating the buffer's state can corrupt unrelated processing. + * *
It is recommended to deserialize a {@code null} {@link ByteBuffer} to a {@code null} object. * *
Note that the passed in {@link Headers} may be empty, but never {@code null}.