Java BufferedWriter Create getBufferedWriter(String filePath, String encoding)

Here you can find the source of getBufferedWriter(String filePath, String encoding)

Description

get Buffered Writer

License

Apache License

Declaration

public static BufferedWriter getBufferedWriter(String filePath, String encoding) throws Exception 

Method Source Code

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

import java.io.BufferedWriter;

import java.io.FileOutputStream;

import java.io.OutputStreamWriter;

public class Main {

    public static BufferedWriter getBufferedWriter(String filePath, String encoding) throws Exception {
        return getBufferedWriter(filePath, encoding, false);
    }/*from ww w  .j av a  2 s . c om*/

    public static BufferedWriter getBufferedWriter(String filePath, String encoding, boolean append)
            throws Exception {
        OutputStreamWriter osw = new OutputStreamWriter(new FileOutputStream(filePath, append), encoding);
        BufferedWriter bw = new BufferedWriter(osw);
        return bw;
    }
}

Related

  1. getBufferedWriter(final Writer out)
  2. getBufferedWriter(OutputStream os)
  3. getBufferedWriter(String directory, String filename)
  4. getBufferedWriter(String file)
  5. getBufferedWriter(String file, String fileCharset)
  6. getBufferedWriter(String path)
  7. getBufferedWriter(String path, String charset, boolean isAppend)
  8. getBufferedWriterOnFile(File file, String format)
  9. toBufferedWriter(Writer w)