Skip to content

Commit 710ec8c

Browse files
author
Niall Pemberton
committed
IO-140 JDK 1.5 changes: Switch from StringWriter to StringBuilderWriter
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/io/trunk@619195 13f79535-47bb-0310-9956-ffa450edef68
1 parent 61b41ee commit 710ec8c

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

src/java/org/apache/commons/io/IOUtils.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
import java.io.OutputStreamWriter;
2929
import java.io.PrintWriter;
3030
import java.io.Reader;
31-
import java.io.StringWriter;
3231
import java.io.Writer;
3332
import java.nio.channels.Channel;
3433
import java.util.ArrayList;
@@ -37,6 +36,7 @@
3736
import java.util.List;
3837

3938
import org.apache.commons.io.output.ByteArrayOutputStream;
39+
import org.apache.commons.io.output.StringBuilderWriter;;
4040

4141
/**
4242
* General IO stream manipulation utilities.
@@ -110,7 +110,7 @@ public class IOUtils {
110110
public static final String LINE_SEPARATOR;
111111
static {
112112
// avoid security issues
113-
StringWriter buf = new StringWriter(4);
113+
StringBuilderWriter buf = new StringBuilderWriter(4);
114114
PrintWriter out = new PrintWriter(buf);
115115
out.println();
116116
LINE_SEPARATOR = buf.toString();
@@ -374,7 +374,7 @@ public static char[] toCharArray(Reader input) throws IOException {
374374
* @throws IOException if an I/O error occurs
375375
*/
376376
public static String toString(InputStream input) throws IOException {
377-
StringWriter sw = new StringWriter();
377+
StringBuilderWriter sw = new StringBuilderWriter();
378378
copy(input, sw);
379379
return sw.toString();
380380
}
@@ -397,7 +397,7 @@ public static String toString(InputStream input) throws IOException {
397397
*/
398398
public static String toString(InputStream input, String encoding)
399399
throws IOException {
400-
StringWriter sw = new StringWriter();
400+
StringBuilderWriter sw = new StringBuilderWriter();
401401
copy(input, sw, encoding);
402402
return sw.toString();
403403
}
@@ -414,7 +414,7 @@ public static String toString(InputStream input, String encoding)
414414
* @throws IOException if an I/O error occurs
415415
*/
416416
public static String toString(Reader input) throws IOException {
417-
StringWriter sw = new StringWriter();
417+
StringBuilderWriter sw = new StringBuilderWriter();
418418
copy(input, sw);
419419
return sw.toString();
420420
}

0 commit comments

Comments
 (0)