BufferedReader
Reads text from the character input stream, buffering individual characters, enabling efficient reading of characters, arrays, and rows.
You can specify the size of the buffer, or you can use the default size. In most cases, the default value is large enough.
Typically, every read request made by reader results in a corresponding read request to the underlying character or byte stream. Therefore, it is recommended to wrap all its read () operations with potentially expensive Reader (such as FileReader and InputStreamReader). For example
BufferedReader in = new BufferedReader (New FileReader ("foo.in"));
The input for the specified file is buffered. Without buffering, each call to read () or readLine () causes the bytes to be read from the file and returned after it is converted to characters, which is extremely inefficient.
By replacing each datainputstream with the appropriate bufferedreader, you can localize a program that uses DataInputStream for text input.
[Java] Java File class Java.io