Class StreamConverter
This utility class is designed to make System.IO.Stream related conversions easier to work with.
Inheritance
System.Object
StreamConverter
Namespace: Cuemon.IO
Assembly: Cuemon.IO.dll
Syntax
public static class StreamConverter
Methods
| Improve this DocFromBytes(Byte[])
Converts the specified value
to a System.IO.Stream.
Declaration
public static Stream FromBytes(byte[] value)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | value | The byte array to be converted. |
Returns
Type | Description |
---|---|
System.IO.Stream | A System.IO.Stream object. |
FromString(String, Action<EncodingOptions>)
Converts the specified value
to a System.IO.Stream.
Declaration
public static Stream FromString(string value, Action<EncodingOptions> setup = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | value | The string to be converted. |
System.Action<EncodingOptions> | setup | The EncodingOptions which need to be configured. |
Returns
Type | Description |
---|---|
System.IO.Stream | A System.IO.Stream object. |
Remarks
EncodingOptions will be initialized with DefaultPreambleSequence and DefaultEncoding.
RemovePreamble(Stream, Encoding)
Removes the preamble information (if present) from the specified System.IO.Stream, and source
is being closed and disposed.
Declaration
public static Stream RemovePreamble(Stream source, Encoding encoding)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | source | The input System.IO.Stream to process. |
System.Text.Encoding | encoding | The encoding to use when determining the preamble to remove. |
Returns
Type | Description |
---|---|
System.IO.Stream | A System.IO.Stream without preamble information. |