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

commit 81ba7d7c10c38a8e09ac72b2cd4fde366a883c77
Author: Gary Gregory <gardgreg...@gmail.com>
AuthorDate: Sun May 16 09:54:20 2021 -0400

    - IOUtils.toByteArray(InputStream) should used an unsynchronized
    ByteArrayOutputStream internally.
    - Improve Javadoc for IOUtils.copy(InputStream OutputStream).
---
 src/main/java/org/apache/commons/io/IOUtils.java | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/apache/commons/io/IOUtils.java 
b/src/main/java/org/apache/commons/io/IOUtils.java
index 25c3528..eaf5856 100644
--- a/src/main/java/org/apache/commons/io/IOUtils.java
+++ b/src/main/java/org/apache/commons/io/IOUtils.java
@@ -55,6 +55,7 @@ import org.apache.commons.io.output.AppendableWriter;
 import org.apache.commons.io.output.ByteArrayOutputStream;
 import org.apache.commons.io.output.NullOutputStream;
 import org.apache.commons.io.output.StringBuilderWriter;
+import org.apache.commons.io.output.UnsynchronizedByteArrayOutputStream;
 
 /**
  * General IO stream manipulation utilities.
@@ -941,7 +942,7 @@ public class IOUtils {
      *
      * @param inputStream the {@code InputStream} to read.
      * @param outputStream the {@code OutputStream} to write.
-     * @return the number of bytes copied, or -1 if &gt; Integer.MAX_VALUE.
+     * @return the number of bytes copied, or -1 if greater than {@link 
Integer#MAX_VALUE}.
      * @throws NullPointerException if the InputStream is {@code null}.
      * @throws NullPointerException if the OutputStream is {@code null}.
      * @throws IOException if an I/O error occurs.
@@ -2396,7 +2397,7 @@ public class IOUtils {
      * @throws IOException if an I/O error occurs.
      */
     public static byte[] toByteArray(final InputStream inputStream) throws 
IOException {
-        try (final ByteArrayOutputStream output = new ByteArrayOutputStream()) 
{
+        try (final UnsynchronizedByteArrayOutputStream output = new 
UnsynchronizedByteArrayOutputStream()) {
             copy(inputStream, output);
             return output.toByteArray();
         }

Reply via email to