Java FileWriter Write saveString(String filePath, String content)

Here you can find the source of saveString(String filePath, String content)

Description

save String

License

Apache License

Declaration

public static void saveString(String filePath, String content) 

Method Source Code

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

import java.io.BufferedWriter;

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

import java.io.PrintWriter;

public class Main {
    public static void saveString(String filePath, String content) {
        PrintWriter pw = null;//w  w  w .  j a va 2s  .  c om
        boolean autoFlush = true;
        try {
            pw = new PrintWriter(new BufferedWriter(new FileWriter(filePath)), autoFlush);
        } catch (IOException e) {
            e.printStackTrace();
            exit(1);
        }
        pw.print(content);
        pw.close();
    }

    public static void exit(int status) {
        System.exit(status);
    }
}

Related

  1. savePValue2File(double[] pValue, String fileName)
  2. saveSeqAln(String[] alnSequences, String filePath)
  3. saveSimpleTextFile(String data, String path, String filename)
  4. saveStats(String filename, String log)
  5. saveString(File filename, String content)
  6. saveString(String location, String content)
  7. saveStringFile(String fileName, String str)
  8. saveStringInFile(String filePath, String data)
  9. saveStringToDisc(final String params, final String filePath)