RecyclableMemoryStream.SafeRead method (1 of 2)
December 6, 2023 · View on GitHub
Reads from the specified position into the provided buffer.
public int SafeRead(Span<byte> buffer, ref long streamPosition)
| parameter | description |
|---|---|
| buffer | Destination buffer. |
| streamPosition | Position in the stream to start reading from. |
Return Value
The number of bytes read.
Exceptions
| exception | condition |
|---|---|
| ObjectDisposedException | Object has been disposed. |
See Also
- class RecyclableMemoryStream
- namespace Microsoft.IO
RecyclableMemoryStream.SafeRead method (2 of 2)
Reads from the specified position into the provided buffer.
public int SafeRead(byte[] buffer, int offset, int count, ref long streamPosition)
| parameter | description |
|---|---|
| buffer | Destination buffer. |
| offset | Offset into buffer at which to start placing the read bytes. |
| count | Number of bytes to read. |
| streamPosition | Position in the stream to start reading from. |
Return Value
The number of bytes read.
Exceptions
| exception | condition |
|---|---|
| ArgumentNullException | buffer is null. |
| ArgumentOutOfRangeException | offset or count is less than 0. |
| ArgumentException | offset subtracted from the buffer length is less than count. |
| ObjectDisposedException | Object has been disposed. |
See Also
- class RecyclableMemoryStream
- namespace Microsoft.IO