Method EndRead

| MongoDB CSharp Driver API Reference (original) (raw)

Namespace

MongoDB.Driver.GridFS

Assembly

MongoDB.Driver.dll

EndRead(IAsyncResult)

public override int EndRead(IAsyncResult asyncResult)

Parameters

asyncResult IAsyncResult

The reference to the pending asynchronous request to finish.

Returns

int

The number of bytes read from the stream, between zero (0) and the number of bytes you requested. Streams return zero (0) only at the end of the stream, otherwise, they should block until at least one byte is available.

Exceptions

ArgumentNullException

asyncResult is null.

ArgumentException

A handle to the pending read operation is not available.
-or-
The pending operation does not support reading.

InvalidOperationException

asyncResult did not originate from a BeginRead(byte[], int, int, AsyncCallback, object) method on the current stream.

IOException

The stream is closed or an internal error has occurred.