Click or drag to resize
ReadBufferReadAsync Method (CancellationToken)
Asynchronously reads bytes into the buffer by calling the callback specified during construction exactly once.

Namespace: Lawo.IO
Assembly: Lawo (in Lawo.dll) Version: 1.4.1707.27006
Syntax
C#
public Task<bool> ReadAsync(
	CancellationToken cancellationToken
)

Parameters

cancellationToken
Type: System.ThreadingCancellationToken

Return Value

Type: TaskBoolean
A task that represents the asynchronous operation. The value of the Result property equals true when at least one byte was read; otherwise false.
Exceptions
ExceptionCondition
InvalidOperationExceptionThe ReadBuffer object was created by calling ReadBuffer(ReadCallback, Int32).
Remarks

After the returned task completes, Count contains the number of bytes in the buffer and Index equals 0.

This function is usually called when Index equals Count, that is, when the client has processed all bytes in the buffer (the whole buffer is filled in this case). If it is called earlier (when Index < Count) then the remaining bytes at the end of the buffer are first copied to the start of the buffer and the now empty part of the buffer is filled by calling the callback.

See Also