EncodingTranslatorStreamReadAsync(MemoryByte, 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.

Definition

Пространство имён: Tessa.Platform.IO
Сборка: Tessa (в Tessa.dll) Версия: 4.2.0+ffad8363f63902f18b3b3f4cfa533a14b2fb19a6
C#
public override ValueTask<int> ReadAsync(
	Memory<byte> buffer,
	CancellationToken cancellationToken = default
)

Параметры

buffer  MemoryByte
The region of memory to write the data into.
cancellationToken  CancellationToken  (Optional)
The token to monitor for cancellation requests. The default value is None.

Возвращаемое значение

ValueTaskInt32
A task that represents the asynchronous read operation. The value of its Result property contains the total number of bytes read into the buffer. The result value can be less than the length of the buffer if that many bytes are not currently available, or it can be 0 (zero) if the length of the buffer is 0 or if the end of the stream has been reached.

Исключения

OperationCanceledExceptionThe cancellation token was canceled. This exception is stored into the returned task.

См. также