Author: sebb
Date: Sat Mar 14 01:50:55 2009
New Revision: 753581

URL: http://svn.apache.org/viewvc?rev=753581&view=rev
Log:
Add Javadoc for second method; combine common code.

Modified:
    
commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/utils/IOUtils.java

Modified: 
commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/utils/IOUtils.java
URL: 
http://svn.apache.org/viewvc/commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/utils/IOUtils.java?rev=753581&r1=753580&r2=753581&view=diff
==============================================================================
--- 
commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/utils/IOUtils.java
 (original)
+++ 
commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/utils/IOUtils.java
 Sat Mar 14 01:50:55 2009
@@ -25,23 +25,32 @@
 public final class IOUtils {
 
        /**
-     * Copies the content of a InputStream into an OutputStream
+     * Copies the content of a InputStream into an OutputStream.
+     * Uses a default buffer size of 8024 bytes.
      * 
      * @param input
      *            the InputStream to copy
      * @param output
      *            the target Stream
      * @throws IOException
-     *             if the streams are interrupted
+     *             if an error occurs
      */
     public static void copy(final InputStream input, final OutputStream 
output) throws IOException {
-        final byte[] buffer = new byte[8024];
-        int n = 0;
-        while (-1 != (n = input.read(buffer))) {
-            output.write(buffer, 0, n);
-        }
+        copy(input, output, 8024);
     }
     
+    /**
+     * Copies the content of a InputStream into an OutputStream
+     * 
+     * @param input
+     *            the InputStream to copy
+     * @param output
+     *            the target Stream
+     * @param buffersize
+     *            the buffer size to use
+     * @throws IOException
+     *             if an error occurs
+     */
     public static void copy(final InputStream input, final OutputStream 
output, int buffersize) throws IOException {
         final byte[] buffer = new byte[buffersize];
         int n = 0;


Reply via email to