System::IO::Stream::ReadAsync 方法

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

异步从当前流读取一系列字节,按读取的字节数前进流中的位置,并监视取消请求。

RTaskPtr<int32_t> System::IO::Stream::ReadAsync(const ArrayPtr<uint8_t> &buffer, int32_t offset, int32_t count)
参数类型描述
bufferconst ArrayPtr<uint8_t>&用于写入读取字节的字节数组。
offsetint32_tbuffer 中的 0 基位置,表示写入的起始位置。
countint32_t要读取的字节数。

ReturnValue

表示异步读取操作的任务。TResult 参数的值包含读取到 buffer 中的字节总数。如果当前可用的字节数少于请求的字节数,则结果值可能小于请求的字节数;如果已到达流的末尾,则结果值可能为 0(零)。

另见

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

异步从当前流读取一系列字节,按读取的字节数前进流中的位置,并监视取消请求。

virtual RTaskPtr<int32_t> System::IO::Stream::ReadAsync(const ArrayPtr<uint8_t> &buffer, int32_t offset, int32_t count, const Threading::CancellationToken &cancellationToken)
参数类型描述
bufferconst ArrayPtr<uint8_t>&用于写入读取字节的字节数组。
offsetint32_tbuffer 中的 0 基位置,表示写入的起始位置。
countint32_t要读取的字节数。
cancellationTokenconst Threading::CancellationToken&用于监视取消请求的令牌。

ReturnValue

表示异步读取操作的任务。TResult 参数的值包含读取到 buffer 中的字节总数。如果当前可用的字节数少于请求的字节数,则结果值可能小于请求的字节数;如果已到达流的末尾,则结果值可能为 0(零)。

另见