StreamExtensionsWriteAsync Method (Stream, Byte, Int32, Int32, CancellationToken) |
Namespace: Rackspace.Threading
public static Task WriteAsync( 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 writing. |
ObjectDisposedException |
If stream has been disposed. |
InvalidOperationException |
If stream is currently in use by a previous write operation. |
Use the CanWrite property to determine whether the stream instance supports writing.
If the operation is canceled before it completes, the returned task contains the Canceled value for the Status property.