I/O streams
Any software system has to receive and produce some kind of data that can be organized as a set of isolated input/output or as a stream of data. A stream can be limited or endless. A program can read from a stream (which is called an input stream) or write to a stream (which is called an output stream). The Java I/O stream is either byte-based or character-based, meaning that its data is interpreted either as raw bytes or as characters.
The java.io
package contains classes that support many, but not all, possible data sources. It is built for the most part around input from and to files, network streams, and internal memory buffers. It does not contain many classes necessary for network communication. They belong to java.net
, javax.net
, and other packages of a Java networking API. Only after the networking source or destination is established (a network socket, for example) can a program read and write data using the InputStream
and OutputStream
classes of the java.io...