Java FileWriter Write save(File pFile, String pString)

Here you can find the source of save(File pFile, String pString)

Description

save

License

Open Source License

Declaration

public static boolean save(File pFile, String pString) 

Method Source Code


//package com.java2s;

import java.io.BufferedWriter;
import java.io.File;

import java.io.FileWriter;

import java.util.Vector;

public class Main {
    public static Vector Exception = new Vector();

    public static boolean save(File pFile, String pString) {
        if (pFile == null)
            return false;
        FileWriter out = null;/*  w  w  w  .ja va2 s .  c o  m*/
        BufferedWriter buf = null;
        try {
            out = new FileWriter(pFile);
            buf = new BufferedWriter(out);
            buf.write(pString);
        } catch (Exception e) {
            return false;
        } finally {
            try {
                if (buf != null)
                    buf.close();
                if (out != null)
                    out.close();
            } catch (Exception e) {
                return false;
            }
        }
        return true;
    }
}

Related

  1. save(File file, String content)
  2. save(File file, String text)
  3. save(final String content, final String file)
  4. save(List list, String REPO)
  5. save(Map map, String path)
  6. save(String fileName, Object o)