BufferedReader java
时间: 2023-12-12 18:11:23 浏览: 35
BufferedReader is a class in Java that reads text from a character-input stream, buffering characters so as to provide for the efficient reading of characters, arrays, and lines. It inherits Reader class and provides more efficient reading of characters, arrays, and lines.
It has a constructor BufferedReader(Reader in) that takes an instance of a Reader class as input and creates a BufferedReader object that can be used to read text from the input stream.
The BufferedReader class provides several methods to read text from the input stream, including read(), readLine(), and skip(). The read() method reads a single character from the input stream, while the readLine() method reads a line of text from the input stream. The skip() method skips over a specified number of characters in the input stream.
The BufferedReader class is commonly used in Java programs for reading text from files, network sockets, and other input sources. It is an efficient way to read text data and provides several useful methods for manipulating and processing the data.