Write code to save string to a file(recover).
//package com.book2s; import java.io.BufferedWriter; import java.io.File; import java.io.FileOutputStream; import java.io.OutputStreamWriter; public class Main { /**//from w w w . j a v a 2s . com * save string to a file(recover). * * @param file * @param content * @return success flag. */ public static final boolean saveString2File(File file, String content) { try { BufferedWriter bw = new BufferedWriter(new OutputStreamWriter( new FileOutputStream(file))); bw.write(content); bw.close(); return true; } catch (Exception e) { return false; } } }