Table of Contents

InvokeToByteArray Method

Definition

Namespace
Cuemon.IO
Assemblies
Cuemon.Kernel.dll
Source
src/Cuemon.Kernel/Extensions/IO/StreamDecoratorExtensions.cs

InvokeToByteArray(IDecorator<Stream>, int, bool)

Converts the enclosed Stream to its byte array representation.

public static byte[] InvokeToByteArray(this IDecorator<Stream> decorator, int bufferSize = 81920, bool leaveOpen = false)

Parameters

decorator IDecorator<Stream>

The IDecorator<T> that wraps the source stream.

bufferSize int

The size of the buffer, in bytes. The value must be greater than zero. The default is 81920.

leaveOpen bool

true to leave the enclosed stream open; otherwise, false.

Returns

byte[]

A byte array containing the contents of the enclosed Stream.

Remarks

This API supports the product infrastructure and is not intended to be used directly from application code.

Exceptions

ArgumentNullException

decorator is null.

ArgumentException

The enclosed Stream does not support reading.