The Byte Stream Classes

Several concrete byte streams are derived from Stream. Those defined in the System.IO namespace are shown here:

Stream Class Description
BufferedStream Wraps a byte stream and adds buffering. Buffering provides a performance enhancement in many cases.
FileStream A byte stream designed for file I/O.
MemoryStream A byte stream that uses memory for storage.
UnmanagedMemoryStream A byte stream that uses unmanaged memory for storage.

Several other concrete stream classes are also supported by the .NET Framework, which provide support for compressed files, sockets, and pipes, among others. It is also possible for you to derive your own stream classes. However, for the vast majority of applications, the built-in streams will be sufficient.

Property Description
bool CanRead This property is true if the stream can be read. This property is read-only.
bool CanSeek This property is true if the stream supports position requests. This property is read-only.
bool CanTimeout This property is true if the stream can time out. This property is read-only.
bool CanWrite This property is true if the stream can be written. This property is read-only.
long Length This property contains the length of the stream. This property is read-only.
long Position This property represents the current position of the stream. This property is read/write.
int ReadTimeout This property represents the length of time before a time-out will occur for read operations. This property is read/write.
int WriteTimeout This property represents the length of time before a time-out will occur for write operations. This property is read/write.