Java Write String to File writeFile(String filePath, String fileContent)

Here you can find the source of writeFile(String filePath, String fileContent)

Description

write File

License

Apache License

Declaration

public static boolean writeFile(String filePath, String fileContent) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.io.FileWriter;
import java.io.IOException;

import java.io.PrintWriter;

public class Main {

    public static boolean writeFile(String filePath, String fileContent) {

        FileWriter fw = null;//ww  w.ja  va2s.c  o  m
        try {
            fw = new FileWriter(filePath, true);
            PrintWriter pw = new PrintWriter(fw);
            pw.print(fileContent);
            pw.close();
            fw.close();
            return true;
        } catch (IOException e) {
        }

        return false;
    }
}

Related

  1. writeFile(String filePath, String content)
  2. writeFile(String filePath, String content)
  3. WriteFile(String filepath, String content)
  4. writeFile(String filePath, String content, boolean append)
  5. writeFile(String filePath, String contents)
  6. writeFile(String filePath, String fileData, boolean isAppend)
  7. writeFile(String filePath, String fileName, String[] args)
  8. writeFile(String filePath, String templetContent, String charsetName)
  9. writeFile(String filePath, String text)