Here you can find the source of saveContent(String context, String filename)
public static void saveContent(String context, String filename)
//package com.java2s; //License from project: Apache License import java.io.File; import java.io.FileWriter; import java.io.IOException; public class Main { public static void saveContent(String context, String filename) { File file = new File(filename); if (!file.exists()) { try { file.createNewFile();//from ww w . j av a 2 s . c om } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } } try { FileWriter writer = new FileWriter(file, true); writer.append(context); writer.flush(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }