Here you can find the source of writeFile(String fileName, String contents)
public static void writeFile(String fileName, String contents) throws FileNotFoundException, UnsupportedEncodingException
//package com.java2s; //License from project: Open Source License import java.io.FileNotFoundException; import java.io.PrintWriter; import java.io.UnsupportedEncodingException; public class Main { public static void writeFile(String fileName, String contents) throws FileNotFoundException, UnsupportedEncodingException { PrintWriter out = new PrintWriter(fileName, "UTF-8"); out.write(contents);/* w w w . j a va2s . c o m*/ out.close(); } }