O'Reilly logo

Java™ Network Programming and Distributed Computing by Michael Reilly, David Reilly

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

4.2. How Streams Work

As mentioned earlier, streams provide communication of data at the byte level, and are used for either reading or writing. Streams for reading inherit from a common superclass, the java.io.InputStream class, shown in Figure 4-3. Likewise, streams used for writing data inherit from the superclass java.io. OutputStream, shown in Figure 4-4. These are abstract classes; they cannot be instantiated. Instead, an appropriate subclass for the task at hand is created. Several streams inherit directly from either InputStream or OutputStream, but most inherit from a filter stream.

Figure 4-3. Input streams inherit from InputStream, although not always directly.
Figure 4-4. Output streams inherit from OutputStream, although not always ...

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