Java Text File Write writeStringToFile(String data, String filename, boolean append)

Here you can find the source of writeStringToFile(String data, String filename, boolean append)

Description

write String To File

License

Open Source License

Declaration

public static void writeStringToFile(String data, String filename, boolean append) throws IOException 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.io.BufferedWriter;

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

public class Main {
    public final static String LINE_BREAK = "\015\012";

    public static void writeStringToFile(String data, String filename, boolean append) throws IOException {
        BufferedWriter br = new BufferedWriter(new PrintWriter(new FileWriter(filename, append)));
        br.write(data);//www.jav a2  s  .  c om
        br.write(LINE_BREAK);
        br.flush();
        br.close();
    }
}

Related

  1. writeStringtoFile(String content, String path)
  2. writeStringToFile(String contents, File outfile)
  3. writeStringToFile(String contents, File outputFile)
  4. writeStringToFile(String contents, String path)
  5. writeStringToFile(String contents, String path, String encoding)
  6. writeStringToFile(String data, String filepath)
  7. writeStringToFile(String f, String s, boolean append)
  8. writeStringToFile(String file, String data, boolean append)
  9. writeStringToFile(String file, String str, boolean append, boolean newLine)