Click or drag to resize
MimeKit

FilteredStreamRead(Byte, Int32, Int32, CancellationToken) 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#
public 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.

Implements

ICancellableStreamRead(Byte, Int32, Int32, CancellationToken)
Exceptions
ExceptionCondition
ArgumentNullExceptionbuffer is null.
ArgumentOutOfRangeException

offset is less than zero or greater than the length of buffer.

-or-

The buffer is not large enough to contain count bytes starting at the specified offset.

ObjectDisposedException The stream has been disposed.
NotSupportedException The stream does not support reading.
OperationCanceledException The operation was canceled via the cancellation token.
IOException An I/O error occurred.
Remarks
Reads up to the requested number of bytes, passing the data read from the Source stream through each of the filters before finally copying the result into the provided buffer.
See Also