1 |
A stream is a sequence of bytes or characters.
|
2 |
Stream sources and sinks include:
-
files
-
network connections
-
blocks of memory
-
threads
|
3 |
That is, all types of streams are treated similarly.
|
4 |
The most basic byte streams are InputStream and OutputStream. These classes have methods that can read or write a byte from or to a stream:
-
int read();
-
void write( int );
-
skip( long ); available(); flush(); close();
|
5 |
All of the above methods throw a possible IOException.
|
6 |
The read() and write( int ) methods "block" during transfer.
|