Class StreamExtensions
Provides extension methods for working with streams.
Inherited Members
Namespace: mk.helpers
Assembly: mk.helpers.dll
Syntax
public static class StreamExtensions
Methods
ReadExactly(Stream, int, int)
Reads exactly the specified number of bytes from the stream.
Declaration
public static byte[] ReadExactly(this Stream stream, int count, int pos = 0)
Parameters
| Type | Name | Description |
|---|---|---|
| Stream | stream | The input stream. |
| int | count | The number of bytes to read. |
| int | pos | The position from which to start reading. Default is 0. |
Returns
| Type | Description |
|---|---|
| byte[] | The byte array containing the read bytes. |
ReadImageFormatFromHeader(Stream)
Reads the image format from the header of the input stream.
Declaration
public static ImageFormat ReadImageFormatFromHeader(this Stream input)
Parameters
| Type | Name | Description |
|---|---|---|
| Stream | input | The input stream. |
Returns
| Type | Description |
|---|---|
| ImageFormat | The detected image format or ImageFormat.None if no match is found. |