Java UTF File Write writeFileUTF(String nom)

Here you can find the source of writeFileUTF(String nom)

Description

write File UTF

License

Open Source License

Declaration

public static PrintWriter writeFileUTF(String nom) throws FileNotFoundException 

Method Source Code


//package com.java2s;
/*//from   ww  w.  ja v  a  2  s .c o m
This source code is copyrighted by Christophe Cerisara, CNRS, France.
    
It is licensed under the terms of the INRIA Cecill-C licence, as described in:
http://www.cecill.info/licences/Licence_CeCILL-C_V1-en.html
 */

import java.io.*;

import java.nio.charset.Charset;

public class Main {
    /** @deprecated use getUTF8Writer instead */
    public static PrintWriter writeFileUTF(String nom) throws FileNotFoundException {
        return new PrintWriter(getUTF8Writer(new File(nom)));
    }

    public static Writer getUTF8Writer(File f) throws FileNotFoundException {
        // http://stackoverflow.com/a/9853261
        return new BufferedWriter(
                new OutputStreamWriter(new FileOutputStream(f), Charset.forName("UTF-8").newEncoder()));
    }
}

Related

  1. getUTF8Writer(String file)
  2. utf8Writer(File file)
  3. utf8Writer(final File f)
  4. writeFile(byte[] data, String outfile)
  5. writeFile(String fileName, ArrayList data, String outputFolder)
  6. writeStringAsUTFByteArrayToDataOutput(final DataOutput out, final String str)
  7. writeToFile(File outputFile, String content)
  8. writeToFile(String outputFile, String contents)
  9. writeToFile(String outputFilePath, String generated)