Java PrintWriter Write saveStringAsFile(String string, String path)

Here you can find the source of saveStringAsFile(String string, String path)

Description

save String As File

License

Open Source License

Declaration

public static boolean saveStringAsFile(String string, String path) 

Method Source Code

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

import java.io.FileNotFoundException;

import java.io.PrintWriter;

public class Main {
    public static boolean saveStringAsFile(String string, String path) {
        PrintWriter out;//w  ww .  jav  a 2 s  .com
        try {
            out = new PrintWriter(path);
            out.println(string);
            out.close();
        } catch (FileNotFoundException e) {
            e.printStackTrace();
            return false;
        }
        return true;
    }
}

Related

  1. saveProbabilityData(String file, double[] probabilities, double start, double dt)
  2. saveProcessedDataFile(double[][] data, String file)
  3. saveSet(Set set, File setFile, String encoding)
  4. saveSortedMap(Map map, File mapFile, String separator, String qualifier, String encoding)
  5. saveString(String theFilePath, String theString)
  6. saveStringBufferTofile(String fileName, StringBuffer sb)
  7. saveStrings(final String filename, final String[] sArray)
  8. saveStrings(String filename, String data[])
  9. saveStrings(String theFilePath, String[] theStrings)