RecyclableMemoryStreamManager.GetStream method (1 of 14)
December 6, 2023 · View on GitHub
Retrieve a new RecyclableMemoryStream object with no tag and a default initial capacity.
public RecyclableMemoryStream GetStream()
Return Value
See Also
- class RecyclableMemoryStream
- class RecyclableMemoryStreamManager
- namespace Microsoft.IO
RecyclableMemoryStreamManager.GetStream method (2 of 14)
Retrieve a new RecyclableMemoryStream object with the contents copied from the provided buffer. The provided buffer is not wrapped or used after construction.
public RecyclableMemoryStream GetStream(byte[] buffer)
| parameter | description |
|---|---|
| buffer | The byte buffer to copy data from. |
Return Value
Remarks
The new stream's position is set to the beginning of the stream when returned.
See Also
- class RecyclableMemoryStream
- class RecyclableMemoryStreamManager
- namespace Microsoft.IO
RecyclableMemoryStreamManager.GetStream method (3 of 14)
Retrieve a new RecyclableMemoryStream object with no tag and a default initial capacity.
public RecyclableMemoryStream GetStream(Guid id)
| parameter | description |
|---|---|
| id | A unique identifier which can be used to trace usages of the stream. |
Return Value
See Also
- class RecyclableMemoryStream
- class RecyclableMemoryStreamManager
- namespace Microsoft.IO
RecyclableMemoryStreamManager.GetStream method (4 of 14)
Retrieve a new RecyclableMemoryStream object with the contents copied from the provided buffer. The provided buffer is not wrapped or used after construction.
public RecyclableMemoryStream GetStream(ReadOnlySpan<byte> buffer)
| parameter | description |
|---|---|
| buffer | The byte buffer to copy data from. |
Return Value
Remarks
The new stream's position is set to the beginning of the stream when returned.
See Also
- class RecyclableMemoryStream
- class RecyclableMemoryStreamManager
- namespace Microsoft.IO
RecyclableMemoryStreamManager.GetStream method (5 of 14)
Retrieve a new RecyclableMemoryStream object with the given tag and a default initial capacity.
public RecyclableMemoryStream GetStream(string? tag)
| parameter | description |
|---|---|
| tag | A tag which can be used to track the source of the stream. |
Return Value
See Also
- class RecyclableMemoryStream
- class RecyclableMemoryStreamManager
- namespace Microsoft.IO
RecyclableMemoryStreamManager.GetStream method (6 of 14)
Retrieve a new RecyclableMemoryStream object with the given tag and a default initial capacity.
public RecyclableMemoryStream GetStream(Guid id, string? tag)
| parameter | description |
|---|---|
| id | A unique identifier which can be used to trace usages of the stream. |
| tag | A tag which can be used to track the source of the stream. |
Return Value
See Also
- class RecyclableMemoryStream
- class RecyclableMemoryStreamManager
- namespace Microsoft.IO
RecyclableMemoryStreamManager.GetStream method (7 of 14)
Retrieve a new RecyclableMemoryStream object with the given tag and at least the given capacity.
public RecyclableMemoryStream GetStream(string? tag, long requiredSize)
| parameter | description |
|---|---|
| tag | A tag which can be used to track the source of the stream. |
| requiredSize | The minimum desired capacity for the stream. |
Return Value
See Also
- class RecyclableMemoryStream
- class RecyclableMemoryStreamManager
- namespace Microsoft.IO
RecyclableMemoryStreamManager.GetStream method (8 of 14)
Retrieve a new RecyclableMemoryStream object with the given tag and with contents copied from the provided buffer. The provided buffer is not wrapped or used after construction.
public RecyclableMemoryStream GetStream(string? tag, ReadOnlySpan<byte> buffer)
| parameter | description |
|---|---|
| tag | A tag which can be used to track the source of the stream. |
| buffer | The byte buffer to copy data from. |
Return Value
Remarks
The new stream's position is set to the beginning of the stream when returned.
See Also
- class RecyclableMemoryStream
- class RecyclableMemoryStreamManager
- namespace Microsoft.IO
RecyclableMemoryStreamManager.GetStream method (9 of 14)
Retrieve a new RecyclableMemoryStream object with the given tag and at least the given capacity.
public RecyclableMemoryStream GetStream(Guid id, string? tag, long requiredSize)
| parameter | description |
|---|---|
| id | A unique identifier which can be used to trace usages of the stream. |
| tag | A tag which can be used to track the source of the stream. |
| requiredSize | The minimum desired capacity for the stream. |
Return Value
See Also
- class RecyclableMemoryStream
- class RecyclableMemoryStreamManager
- namespace Microsoft.IO
RecyclableMemoryStreamManager.GetStream method (10 of 14)
Retrieve a new RecyclableMemoryStream object with the given tag and with contents copied from the provided buffer. The provided buffer is not wrapped or used after construction.
public RecyclableMemoryStream GetStream(Guid id, string? tag, ReadOnlySpan<byte> buffer)
| parameter | description |
|---|---|
| id | A unique identifier which can be used to trace usages of the stream. |
| tag | A tag which can be used to track the source of the stream. |
| buffer | The byte buffer to copy data from. |
Return Value
Remarks
The new stream's position is set to the beginning of the stream when returned.
See Also
- class RecyclableMemoryStream
- class RecyclableMemoryStreamManager
- namespace Microsoft.IO
RecyclableMemoryStreamManager.GetStream method (11 of 14)
Retrieve a new RecyclableMemoryStream object with the given tag and at least the given capacity, possibly using a single contiguous underlying buffer.
public RecyclableMemoryStream GetStream(string? tag, long requiredSize, bool asContiguousBuffer)
| parameter | description |
|---|---|
| tag | A tag which can be used to track the source of the stream. |
| requiredSize | The minimum desired capacity for the stream. |
| asContiguousBuffer | Whether to attempt to use a single contiguous buffer. |
Return Value
Remarks
Retrieving a RecyclableMemoryStream 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.
See Also
- class RecyclableMemoryStream
- class RecyclableMemoryStreamManager
- namespace Microsoft.IO
RecyclableMemoryStreamManager.GetStream method (12 of 14)
Retrieve a new RecyclableMemoryStream object with the given tag and at least the given capacity, possibly using a single contiguous underlying buffer.
public RecyclableMemoryStream GetStream(Guid id, string? tag, long requiredSize,
bool asContiguousBuffer)
| parameter | description |
|---|---|
| id | A unique identifier which can be used to trace usages of the stream. |
| tag | A tag which can be used to track the source of the stream. |
| requiredSize | The minimum desired capacity for the stream. |
| asContiguousBuffer | Whether to attempt to use a single contiguous buffer. |
Return Value
Remarks
Retrieving a RecyclableMemoryStream 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.
See Also
- class RecyclableMemoryStream
- class RecyclableMemoryStreamManager
- namespace Microsoft.IO
RecyclableMemoryStreamManager.GetStream method (13 of 14)
Retrieve a new RecyclableMemoryStream object with the given tag and with contents copied from the provided buffer. The provided buffer is not wrapped or used after construction.
public RecyclableMemoryStream GetStream(string? tag, byte[] buffer, int offset, int count)
| parameter | description |
|---|---|
| tag | A tag which can be used to track the source of the stream. |
| buffer | The byte buffer to copy data from. |
| offset | The offset from the start of the buffer to copy from. |
| count | The number of bytes to copy from the buffer. |
Return Value
Remarks
The new stream's position is set to the beginning of the stream when returned.
See Also
- class RecyclableMemoryStream
- class RecyclableMemoryStreamManager
- namespace Microsoft.IO
RecyclableMemoryStreamManager.GetStream method (14 of 14)
Retrieve a new RecyclableMemoryStream object with the given tag and with contents copied from the provided buffer. The provided buffer is not wrapped or used after construction.
public RecyclableMemoryStream GetStream(Guid id, string? tag, byte[] buffer, int offset, int count)
| parameter | description |
|---|---|
| id | A unique identifier which can be used to trace usages of the stream. |
| tag | A tag which can be used to track the source of the stream. |
| buffer | The byte buffer to copy data from. |
| offset | The offset from the start of the buffer to copy from. |
| count | The number of bytes to copy from the buffer. |
Return Value
Remarks
The new stream's position is set to the beginning of the stream when returned.
See Also
- class RecyclableMemoryStream
- class RecyclableMemoryStreamManager
- namespace Microsoft.IO