public static void writeText(String s) {
   FileWriter fWriter = null;
   BufferedWriter writer = null;
   try {
     fWriter = new FileWriter("info.txt", true);
     writer = new BufferedWriter(fWriter);
     writer.append(s);
     writer.newLine();
     writer.close();
   } catch (Exception e) {
   }
 }
Exemple #2
0
 public static void writeFile(String dir, String fileName, String content) {
   try {
     File f = new File(dir, fileName);
     FileWriter w = new FileWriter(f);
     BufferedWriter bw = new BufferedWriter(w);
     bw.write(content);
     bw.close();
     w.close();
   } catch (IOException ioe) {
     System.err.println("can't write file");
     ioe.printStackTrace(System.err);
   }
 }