Adds a buffering layer to read and write operations on another stream. This class cannot be inherited.
See Also: BufferedStream Members
A buffer is a block of bytes in memory used to cache data, thereby reducing the number of calls to the operating system. Buffers improve read and write performance. A buffer can be used for either reading or writing, but never both simultaneously. The BufferedStream.Read(Byte, int, int) and BufferedStream.Write(Byte, int, int) methods of BufferedStream automatically maintain the buffer.
BufferedStream can be composed around certain types of streams. It provides implementations for reading and writing bytes to an underlying data source or repository. Use System.IO.BinaryReader and System.IO.BinaryWriter for reading and writing other data types. BufferedStream is designed to prevent the buffer from slowing down input and output when the buffer is not needed. If you always read and write for sizes greater than the internal buffer size, then BufferedStream might not even allocate the internal buffer. BufferedStream also buffers reads and writes in a shared buffer. It is assumed that you will almost always be doing a series of reads or writes, but rarely alternate between the two of them.