java.io.Reader
and java.io.Writer
classes are abstract superclasses for classes that read and write character based data.
The subclasses are notable for handling the conversion between different character sets.Input and output streams are fundamentally byte based. However readers and writers are based on characters, which can have varying widths depending on the character set being used. For example, ASCII and ISO Latin-1 use one byte characters. Unicode uses two byte characters. UTF-8 uses characters of varying width between one and three bytes. Readers and writers know how to handle all these character sets and many more seamlessly.