Extensions for performing stream-related tasks.
More...
|
static async Task< MemoryStream > | AsMemoryStreamAsync (this Stream sourceStream) |
| Copies the stream over to a new memoryStream. The new MemoryStream will be at position 0. More...
|
|
static async Task< byte[]> | ToByteArrayAsync (this Stream sourceStream) |
| Fully reads a stream into a byte array. Starts at the current stream position. More...
|
|
static string | ContentToString (this Stream sourceStream, Encoding? encoding=null) |
| Take a stream and return the content as a string. Reads from current stream position, and does not reset the stream position afterwards. Defaults to UTF-8 encoding. More...
|
|
Extensions for performing stream-related tasks.
◆ AsMemoryStreamAsync()
static async Task<MemoryStream> AsMemoryStreamAsync |
( |
this Stream |
sourceStream | ) |
|
|
inlinestatic |
Copies the stream over to a new memoryStream. The new MemoryStream will be at position 0.
- Parameters
-
sourceStream | A MemoryStream to copy over to a new stream. Will be exhausted afterwards. |
- Returns
- A new MemoryStream with the content from sourceStream This stream will be at position 0.
◆ ContentToString()
static string ContentToString |
( |
this Stream |
sourceStream, |
|
|
Encoding? |
encoding = null |
|
) |
| |
|
inlinestatic |
Take a stream and return the content as a string. Reads from current stream position, and does not reset the stream position afterwards. Defaults to UTF-8 encoding.
◆ ToByteArrayAsync()
static async Task<byte[]> ToByteArrayAsync |
( |
this Stream |
sourceStream | ) |
|
|
inlinestatic |
Fully reads a stream into a byte array. Starts at the current stream position.
- Parameters
-
sourceStream | A MemoryStream to copy over to a byte array. Will be exhausted afterwards. |
- Returns
- A byte array with the content from sourceStream .
The documentation for this class was generated from the following file: