Here you can find the source of writeFile(String path, String output)
public static void writeFile(String path, String output) throws IOException
//package com.java2s; //License from project: Apache License import java.io.*; import java.nio.charset.Charset; public class Main { final static Charset UTF8 = Charset.forName("UTF-8"); public static void writeFile(String path, String output) throws IOException { Writer writer = new OutputStreamWriter(new FileOutputStream(path), UTF8); try {//from w ww. ja va 2 s. co m writer.write(output); } finally { writer.close(); } } }