Given a file input stream, you can read 1 byte at a time from that stream.
Generally, however, you want to read 1 character at a time, and characters may occupy more than 1 byte on some operating systems. Accordingly, you insert an input-stream reader between your file input stream and your program.
To create a input-stream reader connected to a file input stream, you use an
expression that creates an instance of the InputStreamReader
class for that file input stream. In the following statement, for example,
you declare an InputStreamReader
variable, and create a
InputStreamReader
instance from a FileInputStream
instance:
File input stream --* | v InputStreamReader reader = new InputStreamReader(stream);