You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by bo...@apache.org on 2019/09/01 14:10:15 UTC

[commons-compress] 03/04: non-blocking ReadableByteChannels may return 0 on read

This is an automated email from the ASF dual-hosted git repository.

bodewig pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-compress.git

commit fbaba0eab63bae94c865e6ba91295b79c8e8cbc1
Author: Stefan Bodewig <bo...@apache.org>
AuthorDate: Sun Sep 1 14:54:36 2019 +0200

    non-blocking ReadableByteChannels may return 0 on read
---
 .../sevenz/BoundedSeekableByteChannelInputStream.java         | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/main/java/org/apache/commons/compress/archivers/sevenz/BoundedSeekableByteChannelInputStream.java b/src/main/java/org/apache/commons/compress/archivers/sevenz/BoundedSeekableByteChannelInputStream.java
index 3b3689e..203f5fb 100644
--- a/src/main/java/org/apache/commons/compress/archivers/sevenz/BoundedSeekableByteChannelInputStream.java
+++ b/src/main/java/org/apache/commons/compress/archivers/sevenz/BoundedSeekableByteChannelInputStream.java
@@ -52,6 +52,17 @@ class BoundedSeekableByteChannelInputStream extends InputStream {
         return -1;
     }
 
+    /**
+     * Reads up to len bytes of data from the input stream into an array of bytes.
+     *
+     * <p>An attempt is made to read as many as len bytes, but a
+     * smaller number may be read. The number of bytes actually read
+     * is returned as an integer.</p>
+     *
+     * <p>This implementation may return 0 if the underlying {@link
+     * SeekableByteChannel} is non-blocking and currently hasn't got
+     * any bytes available.</p>
+     */
     @Override
     public int read(final byte[] b, final int off, final int len) throws IOException {
         if (len == 0) {