1 |
Streams are an abstraction of a sequence of bytes.
|
2 |
The sources and destinations of these sequences can be
-
files
-
network connections
-
blocks of memory
|
3 |
That is, all of these types of I/O are treated in the same way.
|
4 |
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()
|
5 |
There are also methods for reading and writing arrays of bytes.
|
6 |
These methods all "block" on the read or write during the data transfer.
|