IInputStream.ReadAsync(IBuffer, UInt32, InputStreamOptions) 方法

定義

以非同步方式從資料流程讀取資料。

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)

參數

buffer
IBuffer

緩衝區,可用來傳回讀取的位元組。 傳回值包含保留結果的緩衝區。

count
UInt32

unsigned int

uint32_t

要讀取的位元組數目,小於或等於 Capacity 值。

options
InputStreamOptions

指定非同步讀取作業的類型。

傳回

IAsyncOperationWithProgress<IBuffer,UInt32>

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

IAsyncOperationWithProgress<IBuffer,uint32_t>

非同步作業。

範例

使用此方法的範例應用程式包括 HttpClient 範例

備註

一律從 IAsyncOperationWithProgress (IBuffer、 UInt32) 中傳回的緩衝區讀取資料。 請勿假設輸入緩衝區包含資料。 視實作而定,讀取的資料可能會放入輸入緩衝區,或可能會在不同的緩衝區中傳回。 針對輸入緩衝區,您不需要實作 IBuffer 介面。 相反地,您可以建立 Buffer 類別的實例。

也請考慮使用DataReader類別的ReadBuffer方法,將緩衝區讀入IInputStream

適用於

另請參閱