BufferedWriter : BufferedWriter « File « Java Tutorial

You can rap your Writer with a BufferedWriter for better performance. BufferedWriter has the following constructors:

public BufferedWriter (Writer writer)
public BufferedWriter (Writer writer, in bufferSize)

Wrap FileWriter in a BufferedWriter:

FileWriter fw = new FileWriter(aFile);
BufferedWriter bw = new BufferedWriter (fw);

Wrap the Writer to a PrintWriter.

FileWriter fw = new FileWriter (aFile);
PrintWriter pw = new PrintWriter (new BufferedWriter(fw));

11.36.2.Create BufferedWriter from FileWriter
11.36.3.Read Input From User and Write to File
11.36.4.Write to file using a BufferedWriter
11.36.5.Use a BufferedReader and a BufferedWriter to copy a text file, inverting the case of letters in the process
11.36.6.Writing to a File: If the file does not exist, it is automatically created.
11.36.7.Appending to a File
11.36.8.Nested creation of FileWriter, BufferedWriter and PrintWriter