Represents a buffered stream object.
[Visual Basic] Public Class BufferedStream Inherits Stream [C#] public class BufferedStream : Stream [C++] public __gc class BufferedStream : public Stream [JScript] public class BufferedStream extends Stream
A buffer is a block of bytes in memory used to cache data, thereby reducing the number of calls to the operating system. Buffers thus improve read and write performance. A buffer can be used for either reading or writing, but never both simultaneously. The Read and Write 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 BinaryReader and 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. The FileStream class exposes a Stream around a file, supporting both synchronous and asynchronous methods. It is also used to implement the standard in, standard out, and standard error streams. The File class is a utility class with static methods primarily for the creation of FileStream objects based on file paths and the standard input, standard output, and standard error devices. File is used with FileStream.
Namespace: System.IO
Assembly: mscorlib.dll
BufferedStream Members | System.IO Namespace | FileStream | MemoryStream | Stream