Java BufferedWriter Create getBufferedWriter(File file)

Here you can find the source of getBufferedWriter(File file)

Description

Creates a buffered writer for a specified file.

License

Open Source License

Parameter

Parameter Description
file a parameter

Exception

Parameter Description
FileNotFoundException an exception

Return

A BufferedWriter for the specified File.

Declaration

public static BufferedWriter getBufferedWriter(File file)
        throws FileNotFoundException 

Method Source Code

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

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

import java.io.FileNotFoundException;
import java.io.FileOutputStream;

import java.io.OutputStreamWriter;

public class Main {
    /**/*w  w w.j a va 2 s.  c o m*/
     * Creates a buffered writer for a specified file.
     * @param file
     * @return A BufferedWriter for the specified File.
     * @throws FileNotFoundException
     */
    public static BufferedWriter getBufferedWriter(File file)
            throws FileNotFoundException {
        FileOutputStream fos = new FileOutputStream(file);
        OutputStreamWriter osw = new OutputStreamWriter(fos);
        BufferedWriter bw = new BufferedWriter(osw);
        return bw;
    }
}

Related

  1. getBufferedWriter(File f)
  2. getBufferedWriter(final Writer out)
  3. getBufferedWriter(OutputStream os)
  4. getBufferedWriter(String directory, String filename)
  5. getBufferedWriter(String file)