rdhabalia commented on a change in pull request #10184:
URL: https://github.com/apache/pulsar/pull/10184#discussion_r616919819
##########
File path:
pulsar-client-api/src/main/java/org/apache/pulsar/client/api/Schema.java
##########
@@ -120,6 +122,21 @@ default T decode(byte[] bytes, byte[] schemaVersion) {
return decode(bytes);
}
+ /**
+ * Decode a ByteBuf into an object using a given version. <br/>
+ * <b>NOTE</b>: This method should not modify reader/writer index of
ByteBuf else it can cause corruption while
+ * accessing same ByteBuf for decoding and deserialization.
+ *
+ * @param byteBuf
+ * the byte array to decode
+ * @param schemaVersion
+ * the schema version to decode the object. null indicates
using latest version.
+ * @return the deserialized object
+ */
+ default T decode(ByteBuf bytes, byte[] schemaVersion) {
Review comment:
I introduced `ByteBuf` earlier as
[AbstractSchema](https://github.com/apache/pulsar/blob/master/pulsar-client/src/main/java/org/apache/pulsar/client/impl/schema/AbstractSchema.java#L60)
already has the same API so, it won't impact other existing Schema
implementation as all existing impl are extending `AbstracSchema`.
But I agree. `Schema` is part of public API and it should not have ByteBuf.
So, changed to `ByteBuffer`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]