StreamExtensionsReadAsync Method (Stream, Byte, Int32, Int32, CancellationToken) |
Namespace: Rackspace.Threading
public static Task<int> ReadAsync( this Stream stream, byte[] buffer, int offset, int count, CancellationToken cancellationToken )
Exception | Condition |
---|---|
ArgumentNullException |
If stream is . -or- If buffer is . |
ArgumentOutOfRangeException |
If offset is negative. -or- If count is negative. |
ArgumentException |
If the sum of offset and count is larger than the buffer length. |
NotSupportedException |
If stream does not support reading. |
ObjectDisposedException |
If stream has been disposed. |
InvalidOperationException |
If stream is currently in use by a previous read operation. |
Use the CanRead property to determine whether the stream instance supports reading.
If the operation is canceled before it completes, the returned task contains the Canceled value for the Status property.