CopyStreamAsync Method
Definition
- Assemblies
- Cuemon.IO.dll
CopyStreamAsync(IDecorator<Stream>, Stream, int, bool, CancellationToken)
Asynchronously reads the bytes from the enclosed Stream of the specified decorator and writes them to the destination.
public static Task CopyStreamAsync(this IDecorator<Stream> decorator, Stream destination, int bufferSize = 81920, bool changePosition = true, CancellationToken ct = default)
Parameters
decoratorIDecorator<Stream>The IDecorator<T> to extend.
destinationStreamThe Stream to which the contents of the current stream will be copied.
bufferSizeintThe size of the buffer. This value must be greater than zero. The default size is 81920.
changePositionboolif
true, the enclosed Stream of the specifieddecoratorwill temporarily have its position changed to 0; otherwise the position is left untouched.ctCancellationTokenThe token to monitor for cancellation requests. The default value is None.
Returns
Exceptions
- ArgumentNullException
decoratorcannot be null.