Java BufferedWriter Class

Java BufferedWriter class is used to provide buffering for Writer instances. It makes the performance fast. It inherits Writer class. The buffering characters are used for providing the efficient writing of single arrays, characters, and strings.

Class declaration

public class BufferedWriter extends Writer

Class constructors

  1. BufferedWriter(Writer wrt)

    It is used to create a buffered character output stream that uses the default size for an output buffer.

  2. BufferedWriter(Writer wrt, int size)

    It is used to create a buffered character output stream that uses the specified size for an output buffer.


Class methods

  1. void newLine()

    It is used to add a new line by writing a line separator.

  2. void write(int c)

    It is used to write a single character.

  3. void write(char[] cbuf, int off, int len)

    It is used to write a portion of an array of characters.

  4. void flush()

    It is used to flushes the input stream.

Example of Java BufferedWriter

Flash Soon


Output:



Advertisement

Copyright ©2017 Design& develop