Here you can find the source of saveFile(String path, String msg)
public static void saveFile(String path, String msg) throws Exception
//package com.java2s; //License from project: Open Source License import java.io.File; import java.io.FileOutputStream; import java.io.OutputStreamWriter; public class Main { public static void saveFile(String path, String msg) throws Exception { FileOutputStream fos = new FileOutputStream(new File(path)); OutputStreamWriter osw = new OutputStreamWriter(fos); osw.write(msg);//www . jav a2 s . c o m osw.flush(); osw.close(); } }