CachingStream class

A stream wrapper that caches all data read from the underlying Stream.

public sealed class CachingStream : WrappingStreamBase

Public Members

name description
CachingStream(…) Initializes a new instance of the CachingStream class.
override CanWrite { get; } Gets a value indicating whether the current stream supports writing.
override Position { get; set; } Gets or sets the position within the current stream.
override Read(…) Reads a sequence of bytes from the current stream and advances the position within the stream by the number of bytes read.
override ReadAsync(…) Reads a sequence of bytes from the current stream and advances the position within the stream by the number of bytes read. (2 methods)
override ReadByte() Reads a byte from the stream and advances the position within the stream by one byte, or returns -1 if at the end of the stream.
override Seek(…) Sets the position within the current stream.
override SetLength(…) Sets the length of the current stream.
override Write(…) Writes a sequence of bytes to the current stream and advances the current position within this stream by the number of bytes written.
override WriteAsync(…) Asynchronously writes a sequence of bytes to the current stream, advances the current position within this stream by the number of bytes written, and monitors cancellation requests. (2 methods)

Protected Members

name description
override Dispose(…) Disposes or releases the cached stream, based on the value of the Ownership parameter passed to the constructor.

Remarks

This implementation doesn’t enforce any upper bound on the amount of data that will be cached in memory.

See Also