Here you can find the source of writeFile(String path, String content)
public static void writeFile(String path, String content) throws FileNotFoundException, IOException
//package com.java2s; //License from project: Open Source License import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.nio.channels.FileChannel; public class Main { public static void writeFile(String path, String content) throws FileNotFoundException, IOException { FileOutputStream stream = new FileOutputStream(new File(path)); try {//from w ww . j a v a 2s .c om FileChannel fc = stream.getChannel(); stream.write(content.getBytes()); } finally { stream.close(); } } }