Skip to content

Commit 67bcaa5

Browse files
committed
[IO-329] FileUtils.writeLines uses unbuffered IO.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/io/trunk@1343253 13f79535-47bb-0310-9956-ffa450edef68
1 parent 0a331a1 commit 67bcaa5

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

src/changes/changes.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ The <action> type attribute can be add,update,fix,remove.
4747
<body>
4848
<!-- The release date is the date RC is cut -->
4949
<release version="2.4" date="2012-TDB-TDB" description="">
50+
<action issue="IO-329" dev="ggregory" type="fix" due-to="tivv">
51+
FileUtils.writeLines uses unbuffered IO.
52+
</action>
5053
<action issue="IO-327" dev="ggregory" type="add" due-to="ggregory">
5154
Add byteCountToDisplaySize(BigInteger).
5255
</action>

src/main/java/org/apache/commons/io/FileUtils.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
*/
1717
package org.apache.commons.io;
1818

19+
import java.io.BufferedOutputStream;
1920
import java.io.File;
2021
import java.io.FileFilter;
2122
import java.io.FileInputStream;
@@ -2201,11 +2202,11 @@ public static void writeLines(File file, String encoding, Collection<?> lines, S
22012202
* @since 2.1
22022203
*/
22032204
public static void writeLines(File file, String encoding, Collection<?> lines, String lineEnding, boolean append)
2204-
throws IOException {
2205-
OutputStream out = null;
2205+
throws IOException {
2206+
FileOutputStream out = null;
22062207
try {
22072208
out = openOutputStream(file, append);
2208-
IOUtils.writeLines(lines, lineEnding, out, encoding);
2209+
IOUtils.writeLines(lines, lineEnding, new BufferedOutputStream(out), encoding);
22092210
out.close(); // don't swallow close Exception if copy completes normally
22102211
} finally {
22112212
IOUtils.closeQuietly(out);

0 commit comments

Comments
 (0)