Input Stream Wrappers

We have seen several times how a basic I/O class can be wrapped or “decorated” by another I/O class of the same parent class. So it should be no surprise that an InputStream can have a BufferedInputStream and/or a subclass of FilterInputStream interposed between the FileInputStream (or other data source) and the DataInputStream.

There is quite a variety of InputStreams that can decorate the basic access classes. Figure 17-5 shows some, but by no means all, of the most popular classes.

Figure 17-5. Classes that wrap InputStreams

image

You can wrap any or all of the following output streams onto your original InputStream: ...

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.