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 2021/01/11 07:11:14 UTC

[commons-io] branch master updated: Use constant.

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-io.git


The following commit(s) were added to refs/heads/master by this push:
     new 5b6afaf  Use constant.
5b6afaf is described below

commit 5b6afaf302cd5f662b2b943ea0a9da99e9ba99c3
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Mon Jan 11 02:11:10 2021 -0500

    Use constant.
---
 src/main/java/org/apache/commons/io/IOUtils.java | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)

diff --git a/src/main/java/org/apache/commons/io/IOUtils.java b/src/main/java/org/apache/commons/io/IOUtils.java
index 4335885..ea02800 100644
--- a/src/main/java/org/apache/commons/io/IOUtils.java
+++ b/src/main/java/org/apache/commons/io/IOUtils.java
@@ -863,7 +863,7 @@ public class IOUtils {
     public static int copy(final InputStream inputStream, final OutputStream outputStream) throws IOException {
         final long count = copyLarge(inputStream, outputStream);
         if (count > Integer.MAX_VALUE) {
-            return -1;
+            return EOF;
         }
         return (int) count;
     }
@@ -1117,7 +1117,7 @@ public class IOUtils {
     public static int copy(final Reader input, final Writer output) throws IOException {
         final long count = copyLarge(input, output);
         if (count > Integer.MAX_VALUE) {
-            return -1;
+            return EOF;
         }
         return (int) count;
     }
@@ -2255,16 +2255,14 @@ public class IOUtils {
     }
 
     /**
-     * Gets the contents of an <code>InputStream</code> as a <code>byte[]</code>.
-     * Use this method instead of <code>toByteArray(InputStream)</code>
-     * when <code>InputStream</code> size is known
+     * Gets the contents of an <code>InputStream</code> as a <code>byte[]</code>. Use this method instead of
+     * <code>toByteArray(InputStream)</code> when <code>InputStream</code> size is known
      *
-     * @param input the <code>InputStream</code> to read from
-     * @param size the size of <code>InputStream</code>
-     * @return the requested byte array
-     * @throws IOException              if an I/O error occurs or <code>InputStream</code> size differ from parameter
-     * size
-     * @throws IllegalArgumentException if size is less than zero
+     * @param input the <code>InputStream</code> to read.
+     * @param size the size of <code>InputStream</code>.
+     * @return the requested byte array.
+     * @throws IOException if an I/O error occurs or <code>InputStream</code> size differ from parameter size.
+     * @throws IllegalArgumentException if size is less than zero.
      * @since 2.1
      */
     public static byte[] toByteArray(final InputStream input, final int size) throws IOException {