Class StreamDecoratorExtensions
- Namespace
- Cuemon.IO
- Assembly
- Cuemon.Core.dll
Extension methods for the Stream class hidden behind the IDecorator<T> interface. This API supports the product infrastructure and is not intended to be used directly from your code.
public static class StreamDecoratorExtensions
- Inheritance
-
StreamDecoratorExtensions
Methods
CopyStream(IDecorator<Stream>, Stream, Int32, Boolean)
Reads the bytes from the enclosed Stream of the specified decorator
and writes them to the destination
.
public static void CopyStream(this IDecorator<Stream> decorator, Stream destination, int bufferSize = 81920, bool changePosition = true)
Parameters
decorator
IDecorator<Stream>The IDecorator<T> to extend.
destination
StreamThe Stream to which the contents of the current stream will be copied.
bufferSize
Int32The size of the buffer. This value must be greater than zero. The default size is 81920.
changePosition
Booleanif
true
, the enclosed Stream of the specifieddecorator
will temporarily have its position changed to 0; otherwise the position is left untouched.
Exceptions
- ArgumentNullException
decorator
cannot be null.
InvokeToByteArray(IDecorator<Stream>, Int32, Boolean)
Converts the enclosed Stream of the specified decorator
to its equivalent byte[] representation. Not intended to be used directly from your code.
public static byte[] InvokeToByteArray(this IDecorator<Stream> decorator, int bufferSize = 81920, bool leaveOpen = false)
Parameters
decorator
IDecorator<Stream>The IDecorator<T> to extend.
bufferSize
Int32The size of the buffer. This value must be greater than zero. The default size is 81920.
leaveOpen
Booleanif
true
, the Stream object is being left open; otherwise it is being closed and disposed.
Returns
- Byte[]
Exceptions
- ArgumentNullException
decorator
cannot be null.