Java FileWriter Write saveToFile(File file, String text)

Here you can find the source of saveToFile(File file, String text)

Description

save To File

License

Open Source License

Declaration

public static boolean saveToFile(File file, String text) 

Method Source Code

//package com.java2s;
import java.io.File;

import java.io.FileWriter;

import java.io.PrintWriter;

public class Main {
    public static boolean saveToFile(File file, String text) {
        try {/*from   www.j  av a 2s .  c  o  m*/
            PrintWriter outStream = new PrintWriter(new FileWriter(file));
            outStream.print(text);
            outStream.close();
            return true;
        } catch (Exception ex) {
            return false;
        }
    }
}

Related

  1. saveTextFile(String content, File file, boolean append)
  2. saveTextFile(String contents, File file)
  3. saveTextFile(String fileName, String text)
  4. saveToCache(String md, String in, String res)
  5. saveToFile(File file, String string)
  6. saveToFile(List lines, String pathname)
  7. saveToFile(List list, String filename, boolean append)
  8. saveToFile(String fileName, String resultStr)
  9. saveToFile(String fileName, String str)