Skip to main content

BufferedWriter class in java is a class in java programming language. Inside of this class exists 6 public methods. Declaration of this class as follows.

public class 

BufferedWriter public method

There are following useful methods which is define the inside of class.

void close() It closes the stream, flushing it first.
void flush() It flushes the stream.
void newLine() It writes a line separator.
void write(char[] cbuf, int off, int len) It writes a portion of an array of characters.
void write(int c) It writes a single character.
void write(String s, int off, int len) It writes a portion of a String.

This reference is belong to javadoc

Public Constructors

There is 2 types of public constructor is defined inside the class, Whose syntax as follows.


Example of those constructors.

public class Example
    public static void main(String[] args)  throws Exception

        FileWriter writer = new FileWriter("file.txt");  
        BufferedWriter buffer = new BufferedWriter(writer);
        // Put value  
        buffer.write("New Generation");  


Please share your knowledge to improve code and content standard. Also submit your doubts, and test case. We improve by your feedback. We will try to resolve your query as soon as possible.

New Comment