YEncReaderDecodeToAsync Method

Asynchronously decode and validate the current block.

Definition

Namespace: MimeKit.Encodings
Assembly: MimeKit.Core (in MimeKit.Core.dll) Version: 5.0.0
C#
public Task DecodeToAsync(
	Stream destination,
	CancellationToken cancellationToken = default
)

Parameters

destination  Stream
The writable destination.
cancellationToken  CancellationToken  (Optional)
The cancellation token.

Return Value

Task
An awaitable task.

Remarks

Leaves the destination open. Discard its output if the operation fails. Absent checksums are accepted; whole-file checksums of partial ranges remain unverified metadata.

Exceptions

ArgumentNullException destination is null.
ArgumentException The destination is not writable or is the source stream.
FormatException The block is malformed, truncated, or fails size or checksum validation.
InvalidOperationException There is no pending block or the reader has faulted.
ObjectDisposedException The reader is disposed.
OperationCanceledException The operation was canceled.
IOException An I/O error occurred.

See Also