Streams are an abstraction of a sequence of bytes.
|
The sources and destinations of these sequences can be
-
files
-
network connections
-
blocks of memory
|
That is, all of these types of I/O are treated in the same way.
|
The most basic I/O streams are InputStream and OutputStream. These classes have methods that can read or write a byte from the stream:
-
int read ();
-
void write (byte);
-
also skip(), available(), close()
|
There are also methods for reading and writing arrays of bytes.
|
These methods all "block" on the read or write during the data transfer.
|