O'Reilly logo

Java Garage by Eben Hewitt

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Readers and Writers

Java provides a separate set of parent classes for doing character I/O, as opposed to byte IO that is implemented with streams.

Reader is an abstract class, very similar to InputStream. You don't use a reader directly, but rather a different subclass, depending on the source of the characters you need to read.

Writer is also an abstract class, very similar to OutputStream, and its implementing subclasses are used for writing out character data.

Character data comes encoded as a certain character set representation. So let's take a quick detour here before getting into Readers and Writers.

Character Encoding

FileReader and FileWriter read and write double-byte characters. But many native file systems are based on single-byte ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required