You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by se...@apache.org on 2011/05/09 19:20:56 UTC
svn commit: r1101118 - in /commons/proper/io/trunk/src: changes/changes.xml
main/java/org/apache/commons/io/FileUtils.java
Author: sebb
Date: Mon May 9 17:20:56 2011
New Revision: 1101118
URL: http://svn.apache.org/viewvc?rev=1101118&view=rev
Log:
IO-266 FileUtils.copyFile() throws IOException when copying large files to a shared directory
Modified:
commons/proper/io/trunk/src/changes/changes.xml
commons/proper/io/trunk/src/main/java/org/apache/commons/io/FileUtils.java
Modified: commons/proper/io/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/changes/changes.xml?rev=1101118&r1=1101117&r2=1101118&view=diff
==============================================================================
--- commons/proper/io/trunk/src/changes/changes.xml (original)
+++ commons/proper/io/trunk/src/changes/changes.xml Mon May 9 17:20:56 2011
@@ -41,6 +41,9 @@ The <action> type attribute can be add,u
<body>
<release version="1.4" date="Not yet released">
+ <action dev="sebb" type="fix" issue="IO-266" due-to="Igor Smereka">
+ FileUtils.copyFile() throws IOException when copying large files to a shared directory
+ </action>
<action dev="sebb" type="add" issue="IO-251" due-to="Marco Albini">
Add new read method "toByteArray" to handle InputStream with known size.
</action>
Modified: commons/proper/io/trunk/src/main/java/org/apache/commons/io/FileUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/main/java/org/apache/commons/io/FileUtils.java?rev=1101118&r1=1101117&r2=1101118&view=diff
==============================================================================
--- commons/proper/io/trunk/src/main/java/org/apache/commons/io/FileUtils.java (original)
+++ commons/proper/io/trunk/src/main/java/org/apache/commons/io/FileUtils.java Mon May 9 17:20:56 2011
@@ -100,9 +100,9 @@ public class FileUtils {
public static final long ONE_MB = ONE_KB * ONE_KB;
/**
- * The number of bytes in a 50 MB.
+ * The file copy buffer size (30 MB)
*/
- private static final long FIFTY_MB = ONE_MB * 50;
+ private static final long FILE_COPY_BUFFER_SIZE = ONE_MB * 30;
/**
* The number of bytes in a gigabyte.
@@ -880,7 +880,7 @@ public class FileUtils {
long pos = 0;
long count = 0;
while (pos < size) {
- count = (size - pos) > FIFTY_MB ? FIFTY_MB : (size - pos);
+ count = (size - pos) > FILE_COPY_BUFFER_SIZE ? FILE_COPY_BUFFER_SIZE : (size - pos);
pos += output.transferFrom(input, pos, count);
}
} finally {