You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ni...@apache.org on 2008/02/06 23:43:56 UTC

svn commit: r619195 - /commons/proper/io/trunk/src/java/org/apache/commons/io/IOUtils.java

Author: niallp
Date: Wed Feb  6 14:43:55 2008
New Revision: 619195

URL: http://svn.apache.org/viewvc?rev=619195&view=rev
Log:
IO-140 JDK 1.5 changes: Switch from StringWriter to StringBuilderWriter

Modified:
    commons/proper/io/trunk/src/java/org/apache/commons/io/IOUtils.java

Modified: commons/proper/io/trunk/src/java/org/apache/commons/io/IOUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/java/org/apache/commons/io/IOUtils.java?rev=619195&r1=619194&r2=619195&view=diff
==============================================================================
--- commons/proper/io/trunk/src/java/org/apache/commons/io/IOUtils.java (original)
+++ commons/proper/io/trunk/src/java/org/apache/commons/io/IOUtils.java Wed Feb  6 14:43:55 2008
@@ -28,7 +28,6 @@
 import java.io.OutputStreamWriter;
 import java.io.PrintWriter;
 import java.io.Reader;
-import java.io.StringWriter;
 import java.io.Writer;
 import java.nio.channels.Channel;
 import java.util.ArrayList;
@@ -37,6 +36,7 @@
 import java.util.List;
 
 import org.apache.commons.io.output.ByteArrayOutputStream;
+import org.apache.commons.io.output.StringBuilderWriter;;
 
 /**
  * General IO stream manipulation utilities.
@@ -110,7 +110,7 @@
     public static final String LINE_SEPARATOR;
     static {
         // avoid security issues
-        StringWriter buf = new StringWriter(4);
+        StringBuilderWriter buf = new StringBuilderWriter(4);
         PrintWriter out = new PrintWriter(buf);
         out.println();
         LINE_SEPARATOR = buf.toString();
@@ -374,7 +374,7 @@
      * @throws IOException if an I/O error occurs
      */
     public static String toString(InputStream input) throws IOException {
-        StringWriter sw = new StringWriter();
+        StringBuilderWriter sw = new StringBuilderWriter();
         copy(input, sw);
         return sw.toString();
     }
@@ -397,7 +397,7 @@
      */
     public static String toString(InputStream input, String encoding)
             throws IOException {
-        StringWriter sw = new StringWriter();
+        StringBuilderWriter sw = new StringBuilderWriter();
         copy(input, sw, encoding);
         return sw.toString();
     }
@@ -414,7 +414,7 @@
      * @throws IOException if an I/O error occurs
      */
     public static String toString(Reader input) throws IOException {
-        StringWriter sw = new StringWriter();
+        StringBuilderWriter sw = new StringBuilderWriter();
         copy(input, sw);
         return sw.toString();
     }