luyuncheng commented on code in PR #1034:
URL: https://github.com/apache/lucene/pull/1034#discussion_r923536318


##########
lucene/core/src/java/org/apache/lucene/store/ByteBuffersDataOutput.java:
##########
@@ -309,6 +309,24 @@ public byte[] toArrayCopy() {
     return arr;
   }
 
+  @Override
+  public void copyBytes(DataInput input, long numBytes) throws IOException {
+    assert numBytes >= 0 : "numBytes=" + numBytes;
+    int length = (int) numBytes;
+    while (length > 0) {
+      if (!currentBlock.hasRemaining()) {
+        appendBlock();
+      }
+
+      int chunk = Math.min(currentBlock.remaining(), length);
+      final int pos = currentBlock.position();
+      byte[] blockArray = currentBlock.array();

Review Comment:
   ++, Thanks for your advice, i added a check, if currentBlock is direct, then 
break the loop and fall back to `super.copyBytes` for remaining bytes.



-- 
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: issues-unsubscr...@lucene.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to