Java FileWriter Write saveTxtFile(String fileName, String content)

Here you can find the source of saveTxtFile(String fileName, String content)

Description

save Txt File

License

Apache License

Declaration

public static void saveTxtFile(String fileName, String content) 

Method Source Code

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

import java.io.File;

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

public class Main {
    public static void saveTxtFile(String fileName, String content) {
        File file = new File(fileName + ".txt");
        try (FileWriter fw = new FileWriter(file, true)) {
            fw.write(content + "\n");
            fw.flush();//from ww w  .ja  va  2  s.co  m
        } catch (IOException e) {
            e.printStackTrace();
        }

    }
}

Related

  1. saveToFile(String prefix, Reader input)
  2. saveToJson(Object object, String file)
  3. saveToTempFile(File folder, String content, String fileType)
  4. saveTreeStructuredGroupList(ArrayList> treeStructuredGroupList, String filePath)
  5. saveTxt(String line, String filename, boolean isEndSave)