You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@bookkeeper.apache.org by GitBox <gi...@apache.org> on 2017/11/22 10:26:56 UTC

[GitHub] ivankelly commented on a change in pull request #755: Issue 750: support ByteBuf, ByteBuffer, byte[] in both WriteHandle, WriteAdvHandle, ReadHandle

ivankelly commented on a change in pull request #755: Issue 750: support ByteBuf, ByteBuffer, byte[] in both WriteHandle, WriteAdvHandle, ReadHandle
URL: https://github.com/apache/bookkeeper/pull/755#discussion_r152520301
 
 

 ##########
 File path: bookkeeper-server/src/main/java/org/apache/bookkeeper/client/api/LedgerEntry.java
 ##########
 @@ -55,15 +60,28 @@
     long getLength();
 
     /**
-     * Returns the content of the entry.
+     * Returns the content of the entry into a byte array.
      *
      * @return the content of the entry
      */
     byte[] getEntry();
 
+    /**
+     * Exposes this entry's data as an NIO {@link ByteBuffer}. The returned buffer
+     * shares the content with this underneath bytebuf (which you can get it by {@link #getEntryBuffer()}),
+     * while changing the position and limit of the returned NIO buffer does not affect the indexes and
+     * marks of this underneath buffer.  This method is identical
+     * to {@code entry.getEntryBuffer().nioBuffer()}. This method does not
+     * modify {@code readerIndex} or {@code writerIndex} of the underneath bytebuf.
+     */
+    ByteBuffer getNioBuffer();
+
     /**
      * Return the internal buffer that contains the entry payload.
      *
+     * <p>This call doesn't retain any reference on the underneath bytebuf. If you want to use the bytebuf
+     * after the entry is released (via {@link #close()}, the caller must retain the references of the bytebuf.
 
 Review comment:
   ..., the caller must call retain on the ByteBuf.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services