Here you can find the source of writeFile(String f, String s)
public static void writeFile(String f, String s) throws IOException
//package com.java2s; // copyright 2009 ActiveVideo; license: MIT; see license.txt import java.io.*; public class Main { public static void writeFile(String f, String s) throws IOException { OutputStreamWriter out = null; try {/*ww w . ja v a 2 s. co m*/ out = new OutputStreamWriter(new FileOutputStream(f), "UTF-8"); out.write(s); } finally { try { if (out != null) out.close(); } catch (Exception ex) { } } } }