showuon commented on a change in pull request #11187:
URL: https://github.com/apache/kafka/pull/11187#discussion_r684704095
##########
File path: clients/src/main/java/org/apache/kafka/common/utils/Bytes.java
##########
@@ -40,6 +41,26 @@ public static Bytes wrap(byte[] bytes) {
return new Bytes(bytes);
}
+ /**
+ * Create a Bytes using the byte buffer. If the provided byteBuffer
contains the whole content, we can directly
+ * use the backed array. If the byteBuffer has only partial of the content
(ex: a sliced byteBuffer), we'll do array copy
+ *
+ * @param byteBuffer The byteBuffer becomes the backing storage for the
object.
+ */
+ public static Bytes wrap(ByteBuffer byteBuffer) {
Review comment:
Create a `Bytes.wrap` for byteBuffer instance, and see if we can re-use
the backed array directly, or we need to do array copy.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]