Share via


PayloadStream Class

Definition

An extension of Stream that operates in conjunction with a PayloadStreamAssembler to convert raw bytes into a consumable form.

public class PayloadStream : System.IO.Stream
type PayloadStream = class
    inherit Stream
Public Class PayloadStream
Inherits Stream
Inheritance
PayloadStream

Constructors

PayloadStream(PayloadStreamAssembler)

Initializes a new instance of the PayloadStream class.

Properties

CanRead

When overridden in a derived class, gets a value indicating whether the current stream supports reading.

CanSeek

When overridden in a derived class, gets a value indicating whether the current stream supports seeking.

CanWrite

When overridden in a derived class, gets a value indicating whether the current stream supports writing.

Length

When overridden in a derived class, gets the length in bytes of the stream.

Position

When overridden in a derived class, gets or sets the position within the current stream.

Methods

Cancel()

Closes the connected PayloadStreamAssembler and ends production.

Dispose(Boolean)

Releases the unmanaged resources used by the Stream and optionally releases the managed resources.

DoneProducing()

Called when production is cancelled or completed.

Flush()

No-op. PayloadStreams should never be flushed, so we override Stream's Flush to make sure no caller attempts to flush a PayloadStream.

Read(Byte[], Int32, Int32)

This function is called by StreamReader when processing streams. It will appear to have no references, but is in fact required to be implemented by StreamReader, just like Length.

ReadAsync(Byte[], Int32, Int32, CancellationToken)

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.

Seek(Int64, SeekOrigin)

Not supported. Throws NotSupportedException.

SetLength(Int64)

Not supported. Throws NotSupportedException.

Write(Byte[], Int32, Int32)

When overridden in a derived class, writes a sequence of bytes to the current stream and advances the current position within this stream by the number of bytes written.

WriteAsync(Byte[], Int32, Int32, CancellationToken)

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.

Applies to