System::IO::Stream::ReadAsync method

Stream::ReadAsync(const ArrayPtr<uint8_t>&, int32_t, int32_t) method

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.

RTaskPtr<int32_t> System::IO::Stream::ReadAsync(const ArrayPtr<uint8_t> &buffer, int32_t offset, int32_t count)
ParameterTypeDescription
bufferconst ArrayPtr<uint8_t>&The byte array to write the read bytes to.
offsetint32_tA 0-based position in buffer to start writing at.
countint32_tThe number of bytes to read.

ReturnValue

A task that represents the asynchronous read operation. The value of the TResult parameter contains the total number of bytes read into the buffer. The result value can be less than the number of bytes requested if the number of bytes currently available is less than the requested number, or it can be 0 (zero) if the end of the stream has been reached.

See Also

Stream::ReadAsync(const ArrayPtr<uint8_t>&, int32_t, int32_t, const Threading::CancellationToken&) method

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.

virtual RTaskPtr<int32_t> System::IO::Stream::ReadAsync(const ArrayPtr<uint8_t> &buffer, int32_t offset, int32_t count, const Threading::CancellationToken &cancellationToken)
ParameterTypeDescription
bufferconst ArrayPtr<uint8_t>&The byte array to write the read bytes to.
offsetint32_tA 0-based position in buffer to start writing at.
countint32_tThe number of bytes to read.
cancellationTokenconst Threading::CancellationToken&The token to monitor for cancellation requests.

ReturnValue

A task that represents the asynchronous read operation. The value of the TResult parameter contains the total number of bytes read into the buffer. The result value can be less than the number of bytes requested if the number of bytes currently available is less than the requested number, or it can be 0 (zero) if the end of the stream has been reached.

See Also