This is an automated email from the ASF dual-hosted git repository. xuanwo pushed a commit to branch xuanwo/java-get-perf in repository https://gitbox.apache.org/repos/asf/opendal.git
commit 2f49815256f2cb570ecd6c5e88d9c6aa0bab5da6 Author: Xuanwo <[email protected]> AuthorDate: Mon Dec 22 22:06:14 2025 +0800 refactor --- .../org/apache/opendal/OperatorInputStream.java | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/bindings/java/src/main/java/org/apache/opendal/OperatorInputStream.java b/bindings/java/src/main/java/org/apache/opendal/OperatorInputStream.java index edb11d26b..0bf774c8f 100644 --- a/bindings/java/src/main/java/org/apache/opendal/OperatorInputStream.java +++ b/bindings/java/src/main/java/org/apache/opendal/OperatorInputStream.java @@ -58,6 +58,33 @@ public class OperatorInputStream extends InputStream { 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; + } + + if (bytes == null) { + return -1; + } + + final int n = Math.min(len, bytes.length - offset); + System.arraycopy(bytes, offset, b, off, n); + offset += n; + return n; + } + @Override public void close() throws IOException { reader.close();
