Class ByteArrayDecoratorExtensions
- Namespace
- Cuemon
- Assembly
- Cuemon.Core.dll
Extension methods for the byte[] hidden behind the IDecorator<T> interface.
public static class ByteArrayDecoratorExtensions
- Inheritance
-
ObjectByteArrayDecoratorExtensions
Methods
ToEncodedString(IDecorator<Byte[]>, Action<EncodingOptions>)
Converts the enclosed byte[] of the specified decorator
to its equivalent System.String representation.
public static string ToEncodedString(this IDecorator<byte[]> decorator, Action<EncodingOptions> setup = null)
Parameters
decorator
IDecorator<Byte[]>The IDecorator{byte[]} to extend.
setup
Action<EncodingOptions>The EncodingOptions which may be configured.
Returns
- String
A System.String that is equivalent to the enclosed byte[] of the specified
decorator
.
Remarks
EncodingOptions will be initialized with DefaultPreambleSequence and DefaultEncoding.
- See Also
-
IDecorator<T>Decorator<T>
ToStream(IDecorator<Byte[]>)
Converts the enclosed byte[] of the specified decorator
to its equivalent System.IO.Stream representation.
public static Stream ToStream(this IDecorator<byte[]> decorator)
Parameters
decorator
IDecorator<Byte[]>The IDecorator{byte[]} to extend.
Returns
- Stream
A System.IO.Stream that is equivalent to the enclosed byte[] of the specified
decorator
.
Exceptions
- System.ArgumentNullException
decorator
cannot be null.
- See Also
-
IDecorator<T>Decorator<T>
ToStreamAsync(IDecorator<Byte[]>, CancellationToken)
Converts the enclosed byte[] of the specified decorator
to its equivalent System.IO.Stream representation.
public static Task<Stream> ToStreamAsync(this IDecorator<byte[]> decorator, CancellationToken ct = default(CancellationToken))
Parameters
decorator
IDecorator<Byte[]>The IDecorator{byte[]} to extend.
ct
CancellationTokenThe token to monitor for cancellation requests. The default value is System.Threading.CancellationToken.None.
Returns
- Task<Stream>
A task that represents the asynchronous operation. The task result contains a System.IO.Stream that is equivalent to the enclosed byte[] of the specified
decorator
.
Exceptions
- System.ArgumentNullException
decorator
cannot be null.
- See Also
-
IDecorator<T>Decorator<T>