tisonkun commented on code in PR #7088:
URL: https://github.com/apache/opendal/pull/7088#discussion_r2640210149
##########
bindings/java/src/main/java/org/apache/opendal/OperatorInputStream.java:
##########
@@ -58,6 +58,33 @@ public int read() throws IOException {
return -1;
}
+ @Override
+ public int read(byte[] b, int off, int len) throws IOException {
+ if (b == null) {
+ throw new NullPointerException();
+ }
+ if (off < 0 || len < 0 || len > b.length - off) {
+ throw new IndexOutOfBoundsException();
+ }
+ if (len == 0) {
+ return 0;
+ }
+
+ while (bytes != null && offset >= bytes.length) {
+ bytes = readNextBytes(reader.nativeHandle);
+ offset = 0;
+ }
Review Comment:
Weird `while` here.
Perhaps loop over len > 0 and try to copy from bytes until len fulfilled or
end.
--
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]