A Reader is an input stream.
Readers and Writers deal with character streams.
These are abstract classes.
A program must use classes derived from them.
For example, a BufferedReader
is a Reader
(many of our example programs have used BufferedReader
).
Character streams are optimized for handling character data.
They also translate between the internal format used by Java
programs and an external format used for text files.
Inside a Java program character data is represented with
the 16-bit char
data type.
The characters of a String
use the same 16-bit code.
On a disk file, characters are represented in a format called UTF.
This format uses one, two, or three bytes per character and is
intended to be a universal format—one format for all
text files in any language anywhere in the world.
UTF stands for "Universal character set Transformation Format". (Most people decide to forget that and call it "Universal Text Format"). Usually a UTF text file is identical to an ASCII text file. ASCII is the standard that most computers have used up until now. A file created with NotePad is an ASCII text file. However, a UTF text file can include non-ASCII characters such as Cyrillic, Greek, and Asian characters. By reading and writing UTF files, Java programs can process text from any of the World's languages.