GetStream(int, bool) Method
Retrieve a new MemoryStream object with at least the given capacity, possibly using a single continugous underlying buffer.
Namespace
Statiq.Common
Containing Type
IMemoryStreamFactory

Syntax

MemoryStream GetStream(int requiredSize, bool asContiguousBuffer)

Remarks

Retrieving a MemoryStream which provides a single contiguous buffer can be useful in situations where the initial size is known and it is desirable to avoid copying data between the smaller underlying buffers to a single large one. This is most helpful when you know that you will always call GetBuffer on the underlying stream.

Parameters

Name Type Description
requiredSize int The minimum desired capacity for the stream.
asContiguousBuffer bool Whether to attempt to use a single contiguous buffer.

Return Value

Type Description
MemoryStream A MemoryStream.