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 ...
Get Java Garage now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.