
1
lnput and output are performed in Java by means of streams. The same mechanism
is used whether the information is being input or output by means of a file, terminal I/O,
socket, or pipe. Separate streams are used for reading from a source and for writing to a
destination or sink. For both these streams, the mechanism is open a stream, read or write
information, and close the stream. The java.io package provides a large number of classes
to handle the different physical I/O implementations. These are shown in Figures 7.1 to 7.4.
J2SE 1.4 includes the java.nio, or "New I/O," package. ...