Adds a buffering layer to stream I/O.
This class is similar to BufferedStream,
but provides better performance and greater flexibility.
| All Members | Constructors | Methods | Properties | Fields | Events |
| Icon | Member | Description |
|---|---|---|
| BetterBufferedStreamNew(Stream, Int32) |
Creates a new BetterBufferedStream to provide buffered I/O for an existing stream that does not ignore calls to Flush() and has no ReadBehind.
| |
| BetterBufferedStreamNew(Stream, Int32, Boolean) |
Creates a new BetterBufferedStream to provide buffered I/O for an existing stream with no ReadBehind.
| |
| BetterBufferedStreamNew(Stream, Int32, Int32) |
Creates a new BetterBufferedStream to provide buffered I/O for an existing stream that does not ignore calls to Flush().
| |
| BetterBufferedStreamNew(Stream, Int32, Int32, Boolean) |
Creates a new BetterBufferedStream to provide buffered I/O for an existing stream.
| |
| BaseStream |
Retrieves the underlying stream.
| |
| BeginRead(Byte[](), Int32, Int32, AsyncCallback, Object) | Begins an asynchronous read operation. (Inherited from Stream.) | |
| BeginWrite(Byte[](), Int32, Int32, AsyncCallback, Object) | Begins an asynchronous write operation. (Inherited from Stream.) | |
| CanRead |
True if the underlying stream supports reading.
(Overrides Stream.CanRead.) | |
| CanSeek |
True if the underlying stream supports seeking.
(Overrides Stream.CanSeek.) | |
| CanTimeout | Gets a value that determines whether the current stream can time out. (Inherited from Stream.) | |
| CanWrite |
True if the underlying stream supports writing.
(Overrides Stream.CanWrite.) | |
| Close() |
Flushes any buffered output and closes the underlying stream.
Has no effect if Close() has already been called.
(Overrides Stream.Close().) | |
| Close(Boolean) |
Flushes any buffered output and closes the underlying stream
if closeBaseStream is true.
Has no effect if Close() has already been called.
| |
| CreateObjRef(Type) | Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object. (Inherited from MarshalByRefObject.) | |
| CreateWaitHandle() | Obsolete. Allocates a WaitHandle object. (Inherited from Stream.) | |
| EndRead(IAsyncResult) | Waits for the pending asynchronous read to complete. (Inherited from Stream.) | |
| EndWrite(IAsyncResult) | Ends an asynchronous write operation. (Inherited from Stream.) | |
| Equals(Object) | (Inherited from Object.) | |
| Flush() |
If IgnoreFlush is false, flushes any currently buffered output to the underlying stream and then flushes the underlying stream.
(Overrides Stream.Flush().) | |
| ForceFlush() |
Flushes any currently buffered output to the underlying stream and then flushes the underlying stream,
regardless of the value of the IgnoreFlush property.
| |
| GetHashCode() | Serves as a hash function for a particular type. GetHashCode() is suitable for use in hashing algorithms and data structures like a hash table. (Inherited from Object.) | |
| GetLifetimeService() | Retrieves the current lifetime service object that controls the lifetime policy for this instance. (Inherited from MarshalByRefObject.) | |
| GetType() | Gets the Type of the current instance. (Inherited from Object.) | |
| IgnoreFlush |
If true, calls to Flush() will be ignored. This can be useful
if the BetterBufferedStream is wrapped by another stream that flushes
its underlying stream automatically, since avoiding Flush()'s
improves performance. ForceFlush() may still be invoked to
flush the BetterBufferedStream regardless of the IgnoreFlush property.
| |
| InitializeLifetimeService() | Obtains a lifetime service object to control the lifetime policy for this instance. (Inherited from MarshalByRefObject.) | |
| Length |
The length of the stream.
(Overrides Stream.Length.) | |
| MemberwiseClone(Boolean) | Creates a shallow copy of the current MarshalByRefObject object. (Inherited from MarshalByRefObject.) | |
| Position |
Gets or sets the position in the stream where the next read or write operation will take place.
(Overrides Stream.Position.) | |
| Read(Byte[](), Int32, Int32) |
Reads data from the stream.
May return fewer than the requested number of bytes if the internal buffer
does not contain enough data to satisfy the request.
(Overrides Stream.Read(Byte[](), Int32, Int32).) | |
| ReadBehind |
When filling the buffer for reading, this number of bytes from before
the current stream position will be cached. This will improve efficiency
if you frequently seek backwards by this number of bytes
or fewer.
| |
| ReadByte() |
Reads a byte from the stream.
(Overrides Stream.ReadByte().) | |
| ReadTimeout | Gets or sets a value that determines how long the stream will attempt to read before timing out. (Inherited from Stream.) | |
| Seek(Int64, SeekOrigin) |
Sets the position in the stream.
If the underlying stream does not support seeking, a NotSupportedException will be thrown.
(Overrides Stream.Seek(Int64, SeekOrigin).) | |
| SetLength(Int64) |
Sets the length of the stream. The underlying stream must also support SetLength().
(Overrides Stream.SetLength(Int64).) | |
| ToString() | (Inherited from Object.) | |
| Write(Byte[](), Int32, Int32) |
Writes bytes from the provided writeBuffer to the stream.
(Overrides Stream.Write(Byte[](), Int32, Int32).) | |
| WriteByte(Byte) |
Writes a byte to the stream.
(Overrides Stream.WriteByte(Byte).) | |
| WriteTimeout | Gets or sets a value that determines how long the stream will attempt to write before timing out. (Inherited from Stream.) |
As with BufferedStream, frequently switching from writing to reading will negatively affect performance because the buffer must be flushed and then filled with read data.
BetterBufferedStreams improve performance by reducing calls to the underlying stream. For example, setting the position in a BufferedStream will always result in the underlying stream's Position property being set and the buffer flushed or refilled; a BetterBufferedStream, by contrast, is intelligent enough to avoid this unless truly necessary (e.g. when reading, seeking a position outside of the presently buffered data).
| Object | |||
| MarshalByRefObject | |||
| Stream | |||
| BetterBufferedStream | |||