vgritsenko 02/03/29 12:16:34 Modified: src/java/org/apache/cocoon/util IOUtils.java Log: Provide encoding-aware method for string to file IO Revision Changes Path 1.7 +18 -2 xml-cocoon2/src/java/org/apache/cocoon/util/IOUtils.java Index: IOUtils.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/util/IOUtils.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- IOUtils.java 19 Mar 2002 07:55:34 -0000 1.6 +++ IOUtils.java 29 Mar 2002 20:16:34 -0000 1.7 @@ -63,7 +63,7 @@ * * @author <a href="mailto:[EMAIL PROTECTED]">Ricardo Rocha</a> * @author <a href="mailto:[EMAIL PROTECTED]">Stefano Mazzocchi</a> - * @version CVS $Id: IOUtils.java,v 1.6 2002/03/19 07:55:34 cziegeler Exp $ + * @version CVS $Id: IOUtils.java,v 1.7 2002/03/29 20:16:34 vgritsenko Exp $ */ public class IOUtils { @@ -80,7 +80,23 @@ */ public static void serializeString(File file, String string) throws IOException { - final FileWriter fw = new FileWriter(file); + serializeString(file, string, null); + } + + /** + * Dump a <code>String</code> to a text file. + * + * @param file The output file + * @param string The string to be dumped + * @param encoding The encoding for the output file or null for default platform encoding + * @exception IOException IO Error + */ + public static void serializeString(File file, String string, String encoding) + throws IOException { + final Writer fw = + (encoding == null)? + new FileWriter(file): + new OutputStreamWriter(new FileOutputStream(file), encoding); try { fw.write(string); fw.flush();
---------------------------------------------------------------------- In case of troubles, e-mail: [EMAIL PROTECTED] To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]