مشاركة عبر


IInputStream.ReadAsync(IBuffer, UInt32, InputStreamOptions) Method

Definition

Reads data from the stream asynchronously.

public:
 IAsyncOperationWithProgress<IBuffer ^, unsigned int> ^ ReadAsync(IBuffer ^ buffer, unsigned int count, InputStreamOptions options);
IAsyncOperationWithProgress<IBuffer, uint32_t> ReadAsync(IBuffer const& buffer, uint32_t const& count, InputStreamOptions const& options);
public IAsyncOperationWithProgress<IBuffer,uint> ReadAsync(IBuffer buffer, uint count, InputStreamOptions options);
function readAsync(buffer, count, options)
Public Function ReadAsync (buffer As IBuffer, count As UInteger, options As InputStreamOptions) As IAsyncOperationWithProgress(Of IBuffer, UInteger)

Parameters

buffer
IBuffer

A buffer that may be used to return the bytes that are read. The return value contains the buffer that holds the results.

count
UInt32

unsigned int

uint32_t

The number of bytes to read that is less than or equal to the Capacity value.

options
InputStreamOptions

Specifies the type of the asynchronous read operation.

Returns

IAsyncOperationWithProgress<IBuffer,UInt32>

Windows.Foundation.IAsyncOperationWithProgress<Windows.Storage.Streams.IBuffer,unsigned int>

IAsyncOperationWithProgress<IBuffer,uint32_t>

The asynchronous operation.

Examples

Sample applications that use this method include the HttpClient sample.

Remarks

Always read data from the buffer returned in the IAsyncOperationWithProgress(IBuffer, UInt32). Don't assume that the input buffer contains the data. Depending on the implementation, the data that's read might be placed into the input buffer, or it might be returned in a different buffer. For the input buffer, you don't have to implement the IBuffer interface. Instead, you can create an instance of the Buffer class.

Also consider reading a buffer into an IInputStream by using the ReadBuffer method of the DataReader class.

Applies to

See also