YEncWriterWrite Method

Write a complete yEnc block.

Definition

Namespace: MimeKit.Encodings
Assembly: MimeKit.Core (in MimeKit.Core.dll) Version: 5.0.0
C#
public uint Write(
	YEncHeader header,
	Stream source,
	uint? fileChecksum = null,
	CancellationToken cancellationToken = default
)

Parameters

header  YEncHeader
The block metadata.
source  Stream
The source of this block's decoded bytes.
fileChecksum  NullableUInt32  (Optional)
An optional finalized whole-file CRC32.
cancellationToken  CancellationToken  (Optional)
The cancellation token.

Return Value

UInt32
The finalized CRC32 of this block.

Remarks

Writes framing, payload and a checksum trailer. Leaves the source open and does not flush the destination. The source must end at exactly the declared decoded size; size errors invalidate the output. A supplied whole-file checksum for a partial range is emitted without verification.

Exceptions

ArgumentNullException header or source is null.
ArgumentException A stream, filename encoding or header is invalid.
ArgumentOutOfRangeException The header exceeds the configured limits or the writer's line-length range of 60 through 998.
FormatException The source size or supplied checksum does not match.
InvalidOperationException The writer has faulted.
ObjectDisposedException The writer is disposed.
OperationCanceledException The operation was canceled.
IOException An I/O error occurred.

See Also