A subset of the Reader hierarchy
-
Reader <<abstract>>
-
BufferedReader
-
InputStreamReader
-
FileReader
-
-
Classes used to connect to a file with a buffer
-
BufferedReader – contains methods for reading data from the stream
-
FileReader – connects the stream to a file
-
Constructors of these classes
Method | Throws |
BufferedReader(Reader) | None |
FileReader(File) | FileNotFoundException |
FileReader(StringFileName) | FileNotFoundException |
Example 1: How to connect a character input stream to a file
BufferedReader in = new BufferedReader( new FileReader(productsFile));Descriptions:
-
Although you can read files with the FileReader class alone, the BufferedReader class improves efficiency and provides better methods for reading character input streams.
More info can be found here: http://www.j2ee.me/javase/6/docs/api/java/io/BufferedReader.html