Wrapping Additional Output Classes

As Figure 17-3 suggests, the java.io package has more classes that you can wrap around a Writer or OutputStream. The additional Writer wrapping classes can do things like filter the text as it goes by, or buffer it for performance. The additional OutputStream wrapping classes can bridge to a Writer class, filter, buffer, encrypt, and/or compress that data! When you wrap classes, only write from the outermost one. Otherwise, your I/O may get scrambled due to internal buffering.

Figure 17-3. Wrapping more writer classes

image

All these additional wrappers go between what we have termed the top layer classes and ...

Get Just Java™ 2 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.