Class HandlerContent
Content that can be used in a handler. Can be streaming or fixed set of bytes.
public class HandlerContent
- Inheritance
-
HandlerContent
- Inherited Members
Constructors
HandlerContent(byte[], IReadOnlyDictionary<string, string>?)
Initializes a new instance of the HandlerContent class from a fixed set of bytes.
public HandlerContent(byte[] bytes, IReadOnlyDictionary<string, string>? headers = null)
Parameters
bytesbyte[]Byte array.
headersIReadOnlyDictionary<string, string>Headers if any.
HandlerContent(Stream, IReadOnlyDictionary<string, string>?)
Initializes a new instance of the HandlerContent class from a stream.
public HandlerContent(Stream stream, IReadOnlyDictionary<string, string>? headers = null)
Parameters
streamStreamByte stream.
headersIReadOnlyDictionary<string, string>Headers if any.
Properties
Headers
Gets the headers on this content if any.
public IReadOnlyDictionary<string, string>? Headers { get; }
Property Value
Methods
ConsumeAllBytes()
Consume all bytes as a byte array. Once this has been called, it cannot be called again.
public byte[] ConsumeAllBytes()
Returns
- byte[]
All bytes.
Exceptions
- InvalidOperationException
Already consumed.
ConsumeStream()
Take the stream off this content for consumption. Once this has been called, it cannot be called again.
public Stream ConsumeStream()
Returns
- Stream
Stream.
Exceptions
- InvalidOperationException
Already consumed.