OwnedReadStream.ReadAsync
Section titled “OwnedReadStream.ReadAsync”
- 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.
Required contracts
Section titled “Required contracts”API: engine
Project: Inno.Core.IO
Declaration
Section titled “Declaration”public override System.Threading.Tasks.ValueTask<int> Inno.Core.IO.OwnedReadStream.ReadAsync(System.Memory<byte> buffer, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))Parameters
Section titled “Parameters”Parameter buffer: The region of memory to write the data into.
Parameter cancellationToken: The token to monitor for cancellation requests. The default value is P:System.Threading.CancellationToken.None.
Exceptions
Section titled “Exceptions”Exception T:System.OperationCanceledException: The cancellation token was canceled. This exception is stored into the returned task.
Returns
Section titled “Returns”A task that represents the asynchronous read operation. The value of its P:System.Threading.Tasks.ValueTask`1.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.