commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r759478 - /commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/utils/IOUtils.java
Date Sat, 28 Mar 2009 15:06:17 GMT
Author: sebb
Date: Sat Mar 28 15:06:17 2009
New Revision: 759478

URL: http://svn.apache.org/viewvc?rev=759478&view=rev
Log:
Return count of bytes copied

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

Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/utils/IOUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/utils/IOUtils.java?rev=759478&r1=759477&r2=759478&view=diff
==============================================================================
--- commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/utils/IOUtils.java
(original)
+++ commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/utils/IOUtils.java
Sat Mar 28 15:06:17 2009
@@ -39,8 +39,8 @@
      * @throws IOException
      *             if an error occurs
      */
-    public static void copy(final InputStream input, final OutputStream output) throws IOException
{
-        copy(input, output, 8024);
+    public static long copy(final InputStream input, final OutputStream output) throws IOException
{
+        return copy(input, output, 8024);
     }
     
     /**
@@ -55,11 +55,14 @@
      * @throws IOException
      *             if an error occurs
      */
-    public static void copy(final InputStream input, final OutputStream output, int buffersize)
throws IOException {
+    public static long copy(final InputStream input, final OutputStream output, int buffersize)
throws IOException {
         final byte[] buffer = new byte[buffersize];
         int n = 0;
+        long count=0;
         while (-1 != (n = input.read(buffer))) {
             output.write(buffer, 0, n);
+            count += n;
         }
+        return count;
     }
 }



Mime
View raw message