Here you can find the source of saveToFile(String fileName, String resultStr)
public static void saveToFile(String fileName, String resultStr)
//package com.java2s; //License from project: Open Source License import java.io.*; public class Main { public static void saveToFile(String fileName, String resultStr) { try {// w w w . ja v a 2 s .c o m FileWriter fileWriter; File newTextFile = new File(fileName); fileWriter = new FileWriter(newTextFile, true); fileWriter.write(resultStr); fileWriter.close(); } catch (IOException iOException) { } } public static void saveToFile(String fileName, byte[] data) { try { try (FileOutputStream out = new FileOutputStream(fileName, true)) { out.write(data); } } catch (IOException iOException) { System.err.println(iOException.getMessage()); } } }