You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2024/11/22 21:30:37 UTC

(commons-compress) branch master updated: Update outdated descriptions in IOUtils and IOUtilsTest (#612)

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 6dff447e7 Update outdated descriptions in IOUtils and IOUtilsTest (#612)
6dff447e7 is described below

commit 6dff447e7de687566f9edf6197ed92be07ff4547
Author: Glavo <zj...@gmail.com>
AuthorDate: Sat Nov 23 05:30:32 2024 +0800

    Update outdated descriptions in IOUtils and IOUtilsTest (#612)
    
    * Update outdated descriptions in IOUtils and IOUtilsTest
    
    * update javadoc
    
    * update javadoc
---
 .../java/org/apache/commons/compress/utils/IOUtils.java   | 15 ++++++++-------
 .../org/apache/commons/compress/utils/IOUtilsTest.java    |  2 +-
 2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/src/main/java/org/apache/commons/compress/utils/IOUtils.java b/src/main/java/org/apache/commons/compress/utils/IOUtils.java
index 2b5fb29c2..abe4bfff4 100644
--- a/src/main/java/org/apache/commons/compress/utils/IOUtils.java
+++ b/src/main/java/org/apache/commons/compress/utils/IOUtils.java
@@ -73,12 +73,13 @@ public final class IOUtils {
     }
 
     /**
-     * Copies the content of a InputStream into an OutputStream. Uses a default buffer size of 8024 bytes.
+     * Copies the content of a InputStream into an OutputStream. Uses a default buffer size of 8192 bytes.
      *
      * @param input  the InputStream to copy
-     * @param output the target, may be null to simulate output to dev/null on Linux and NUL on Windows
-     * @return the number of bytes copied
+     * @param output the target
+     * @return the number of bytes copied, or -1 if greater than {@link Integer#MAX_VALUE}
      * @throws IOException if an error occurs
+     * @throws NullPointerException if the {@code input} or the {@code output} is {@code null}
      * @deprecated Use {@link org.apache.commons.io.IOUtils#copy(InputStream, OutputStream)}.
      */
     @Deprecated
@@ -90,11 +91,11 @@ public final class IOUtils {
      * Copies the content of a InputStream into an OutputStream
      *
      * @param input      the InputStream to copy
-     * @param output     the target, may be null to simulate output to dev/null on Linux and NUL on Windows
+     * @param output     the target
      * @param bufferSize the buffer size to use, must be bigger than 0
      * @return the number of bytes copied
      * @throws IOException              if an error occurs
-     * @throws IllegalArgumentException if bufferSize is smaller than or equal to 0
+     * @throws NullPointerException if the {@code input} or the {@code output} is {@code null}
      * @deprecated Use {@link org.apache.commons.io.IOUtils#copy(InputStream, OutputStream, int)}.
      */
     @Deprecated
@@ -103,7 +104,7 @@ public final class IOUtils {
     }
 
     /**
-     * Copies part of the content of a InputStream into an OutputStream. Uses a default buffer size of 8024 bytes.
+     * Copies part of the content of a InputStream into an OutputStream. Uses a default buffer size of 8192 bytes.
      *
      * @param input  the InputStream to copy
      * @param output the target Stream
@@ -291,7 +292,7 @@ public final class IOUtils {
      * @param input the {@code InputStream} to read from
      * @return the requested byte array
      * @throws NullPointerException if the input is null
-     * @throws IOException          if an I/O error occurs
+     * @throws IOException          if an I/O error occurs or reads more than {@link Integer#MAX_VALUE} occurs
      * @since 1.5
      * @deprecated Use {@link org.apache.commons.io.IOUtils#toByteArray(InputStream)}.
      */
diff --git a/src/test/java/org/apache/commons/compress/utils/IOUtilsTest.java b/src/test/java/org/apache/commons/compress/utils/IOUtilsTest.java
index fc8993793..2410dc9f2 100644
--- a/src/test/java/org/apache/commons/compress/utils/IOUtilsTest.java
+++ b/src/test/java/org/apache/commons/compress/utils/IOUtilsTest.java
@@ -107,7 +107,7 @@ public class IOUtilsTest {
     }
 
     @Test
-    public void testCopyThrowsOnZeroBufferSize() throws IOException {
+    public void testCopyOnZeroBufferSize() throws IOException {
         assertEquals(0, IOUtils.copy(new ByteArrayInputStream(ByteUtils.EMPTY_BYTE_ARRAY), new ByteArrayOutputStream(), 0));
     }