Munoon commented on code in PR #1483: URL: https://github.com/apache/incubator-fury/pull/1483#discussion_r1558960787
########## java/fury-core/src/main/java/org/apache/fury/io/FuryReadableChannel.java: ########## @@ -128,21 +128,21 @@ public void readToUnsafe(Object target, long targetPointer, int numBytes) { @Override public void readToByteBuffer(ByteBuffer dst, int length) { - readToByteBuffer0(dst, length); + MemoryBuffer buf = memoryBuffer; + int remaining = buf.remaining(); + if (remaining < length) { + remaining += fillBuffer(length - remaining); + } + buf.read(dst, remaining); } @Override public int readToByteBuffer(ByteBuffer dst) { - return readToByteBuffer0(dst, dst.remaining()); - } - - private int readToByteBuffer0(ByteBuffer dst, int length) { MemoryBuffer buf = memoryBuffer; int remaining = buf.remaining(); - if (remaining < length) { - remaining += fillBuffer(length - remaining); + if (remaining > 0) { + buf.read(dst, remaining); Review Comment: Fine, so we are expecting the the `ByteBuffer dst` have already set up the correct limit before invoking this method. -- 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: commits-unsubscr...@fury.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@fury.apache.org For additional commands, e-mail: commits-h...@fury.apache.org