his chapter explores java.io, which provides support for I/O operations. In Chapter 13,
we presented an overview of Java's I/O system. Here, we will examine the Java I/O
system in greater detail.
As all programmers learn early on, most programs cannot accomplish their goals without
accessing external data. Data is retrieved from an input source. The results of a program are
sent to an output destination. In Java, these sources or destinations are defined very broadly.
For example, a network connection, memory buffer, or disk file can be manipulated by the
Java I/O classes. Although physically different, these devices are all handled by the same
abstraction: the stream. A stream, as explained in Chapter 13, is a logical entity that either
produces or consumes information. A stream is linked to a physical device by the Java I/O
system. All streams behave in the same manner, even if the actual physical devices they are
linked to differ.
NOTE In addition to the I/O capabilities discussed here, Java provides further I/O support in the
java.nio package, which is described in Chapter 27.
The Java I/O Classes and Interfaces
The I/O classes defined by java.io are listed here:
Search WWH :