Java BufferedReader Class

Java BufferedReader class is used to read the text from a character-based input stream. It can be used to read data line by line by readLine() method. It makes the performance fast. It inherits Reader class.

BufferedReader declaration

public class BufferedReader extends Reader

BufferedReader constructors

  1. BufferedReader(Reader rd)

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

  2. BufferedReader(Reader rd, int size)

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


Java BufferedReader class methods

  1. int read()

    It is used for reading a single character.

  2. int read(char[] cbuf, int off, int len)

    It is used for reading characters into a portion of an array.

  3. boolean markSupported()

    It is used to test the input stream support for the mark and reset method.

  4. String readLine()

    It is used for reading a line of text.

Java BufferedReader Example

Flash Soon


Output:



Advertisement

Copyright ©2017 Design& develop