Weve now gone through an overview of the
.NET Framework and the CLR. Weve talked about
the motivating factors behind these technologies and the key
benefits that they provide. Finally, weve
discussed the elements contained within the .NET Framework that are
most
The Microsoft Windows .NET Framework offers a unified way to
access operating system resources such as files, memory, and
network resources through the stream I/O pattern. Streams provide a
common way to perform I/O operations regardless of the operating
system resource. In general, streams allow you to read and write
data sequentially to a container (which we call a
backing
store
) as if the data is a continuous sequence of bytes where
the first byte that s written becomes the first
byte to be read, and so on. The container is called a backing store
because it will typically hold or store the data
that s written to the stream. Figure 2-1
describes a stream as a sheet of paper where the paper represents a
backing store that can hold letters of the alphabet. A supplier or
writer can write the
Figure 2-1:
The stream I/O process
In this chapter, you ll discover how to
perform I/O on files, memory, and networks using stream classes in
the .NET Framework. We ll start out describing
the
Stream
class that s inherited by
several classes that allow you to perform I/O in a common way
across different operating system resources.
We ll focus mostly on performing I/O on files
and network resources because this is a network programming book.
Once we have described the core stream classes,
we ll talk about other stream classes that
interact with the
There are two types of streams available: base and
Figure 2-2 shows a stream relationship diagram that describes
how base streams and composable streams interact with one another.
At the top of the diagram, you ll see stream
readers and writers that are
Figure 2-2:
Stream relationship
diagram