Here you can find the source of writeString(String contents, File file)
public static void writeString(String contents, File file) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.File; import java.io.FileWriter; import java.io.IOException; public class Main { public static void writeString(String contents, File file) throws IOException { FileWriter out = new FileWriter(file); try {/* ww w.j a va 2s. c om*/ out.write(contents); } finally { out.close(); } } }