You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by sc...@apache.org on 2005/09/28 22:53:25 UTC

svn commit: r292296 - in /jakarta/commons/proper/io/trunk: RELEASE-NOTES.txt src/java/org/apache/commons/io/FileUtils.java

Author: scolebourne
Date: Wed Sep 28 13:53:20 2005
New Revision: 292296

URL: http://svn.apache.org/viewcvs?rev=292296&view=rev
Log:
FileUtils.writeStringToFile() - Null encoding now uses the platform default

Modified:
    jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt
    jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileUtils.java

Modified: jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt?rev=292296&r1=292295&r2=292296&view=diff
==============================================================================
--- jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt (original)
+++ jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt Wed Sep 28 13:53:20 2005
@@ -22,11 +22,11 @@
 Source compatible - Yes
 
 Semantic compatible - Yes, except:
-- FileUtils - touch()
+- FileUtils.touch()
     Now creates the file if it did not previously exist
     (Bug fix 29821)
 
-- FileUtils - toFile(URL)
+- FileUtils.toFile(URL)
     Now handles escape syntax such as %20
     (Bug fix 32575)
 
@@ -34,6 +34,10 @@
     May now return a size of 0 if the directory is security restricted
     (Bug fix 36801)
 
+- FileUtils.writeStringToFile()
+    A null encoding previously used 'ISO-8859-1', now it uses the platform default
+    Generally this will make no difference
+
 
 Deprecations from 1.0
 ---------------------
@@ -72,6 +76,9 @@
 - FileUtils  [36801]
     Previously threw NPE when listing files in a security restricted directory
     Now throw IOException with a better message
+
+- FileUtils - writeStringToFile()
+    Null encoding now correctly uses the platform default
 
 
 Enhancements from 1.0

Modified: jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileUtils.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileUtils.java?rev=292296&r1=292295&r2=292296&view=diff
==============================================================================
--- jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileUtils.java (original)
+++ jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileUtils.java Wed Sep 28 13:53:20 2005
@@ -763,7 +763,7 @@
      * </p>
      *
      * @param file  the file to read
-     * @param encoding  the encoding to use
+     * @param encoding  the encoding to use, null means platform default
      * @return The file contents or null if read failed.
      * @throws IOException in case of an I/O error
      * @throws UnsupportedEncodingException if the encoding is not supported by the VM
@@ -808,7 +808,7 @@
      * </p>
      *
      * @param file  the file to read
-     * @param encoding  the encoding to use
+     * @param encoding  the encoding to use, null means platform default
      * @return the list of Strings representing each line in the file
      * @throws IOException in case of an I/O error
      * @throws UnsupportedEncodingException if the encoding is not supported by the VM
@@ -836,7 +836,7 @@
      *
      * @param file  the file to write
      * @param data  the content to write to the file
-     * @param encoding  encoding to use
+     * @param encoding  the encoding to use, null means platform default
      * @throws IOException in case of an I/O error
      * @throws UnsupportedEncodingException if the encoding is not supported by the VM
      */
@@ -844,7 +844,7 @@
             String data, String encoding) throws IOException {
         OutputStream out = new FileOutputStream(file);
         try {
-            out.write(data.getBytes(encoding));
+            IOUtils.write(data, out, encoding);
         } finally {
             IOUtils.closeQuietly(out);
         }



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org