Click or drag to resize
MimeKit

ICancellableStreamRead Method

Read a sequence of bytes from the stream and advances the position within the stream by the number of bytes read.

Namespace: MimeKit.IO
Assembly: MimeKit (in MimeKit.dll) Version: 4.3.0
Syntax
C#
int Read(
	byte[] buffer,
	int offset,
	int count,
	CancellationToken cancellationToken
)

Parameters

buffer  Byte
The buffer to read data into.
offset  Int32
The offset into the buffer to start reading data.
count  Int32
The number of bytes to read.
cancellationToken  CancellationToken
The cancellation token.

Return Value

Int32
The total number of bytes read into the buffer. This can be less than the number of bytes requested if that many bytes are not currently available, or zero (0) if the end of the stream has been reached.
Remarks

When a custom stream implementation also implements this interface, the MimeParser will opt to use this interface instead of the normal Read(Byte, Int32, Int32) API to read data from the stream.

This is really useful when parsing a message or other MIME entity directly from a network-based stream.

See Also