Fundamental operations on streams
The two fundumental operations on streams are:
- Reading data from a stream (usually into a
Byte[]
)
- Writing Data into a stream (usually from a
Byte[]
)
Some streams have a third fundamental operation: moving to a specific location within the stream. A typical example for such a stream is a file. An example, where moving to a specific position doesn't make lot of sense is a TCP/IP connection.
In order to find out which operations are possible, a stream provides the following three methods:
-
CanRead()
-
CanWrite()
-
CanSeek()