WrappingStream class

A Stream that wraps another stream. One major feature of WrappingStream is that it does not dispose the underlying stream when it is disposed if Ownership.None is used; this is useful when using classes such as BinaryReader that take ownership of the stream passed to their constructors.

public sealed class WrappingStream : Stream

Public Members

name description
WrappingStream(…) Initializes a new instance of the WrappingStream class.
override CanRead { get; } Gets a value indicating whether the current stream supports reading.
override CanSeek { get; } Gets a value indicating whether the current stream supports seeking.
override CanTimeout { get; } Gets a value that determines whether the current stream can time out.
override CanWrite { get; } Gets a value indicating whether the current stream supports writing.
override Length { get; } Gets the length in bytes of the stream.
override Position { get; set; } Gets or sets the position within the current stream.
override ReadTimeout { get; set; } Gets or sets a value, in milliseconds, that determines how long the stream will attempt to read before timing out.
override WriteTimeout { get; set; } Gets or sets a value, in milliseconds, that determines how long the stream will attempt to write before timing out.
override BeginRead(…) Begins an asynchronous read operation.
override BeginWrite(…) Begins an asynchronous write operation.
override CopyTo(…) Copies this stream to a destination stream.
override CopyToAsync(…) Asynchronously reads the bytes from the current stream and writes them to another stream, using a specified buffer size and cancellation token.
override EndRead(…) Waits for the pending asynchronous read to complete.
override EndWrite(…) Ends an asynchronous write operation.
override Flush() Clears all buffers for this stream and causes any buffered data to be written to the underlying device.
override FlushAsync(…) Asynchronously clears all buffers for this stream, causes any buffered data to be written to the underlying device, and monitors cancellation requests.
override Read(…) 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 ReadAsync(…) Asynchronously reads a sequence of bytes from the current stream, advances the position within the stream by the number of bytes read, and monitors cancellation requests. (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. (2 methods)
override WriteAsync(…) Asynchronously writes a sequence of bytes to the current stream and advances the current position within this stream by the number of bytes written. (2 methods)
override WriteByte(…) Writes a byte to the current position in the stream and advances the position within the stream by one byte.

Protected Members

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

See Also