Class HttpEntityStream<TEntity>
Exposes an HTTP body as a stream of deserialized entities.
public class HttpEntityStream<TEntity>
Type Parameters
TEntityThe type of entity this stream provides.
- Inheritance
-
HttpEntityStream<TEntity>
- Inherited Members
Constructors
HttpEntityStream(HttpContent, MediaTypeFormatter, string, int)
Creates a new HTTP entity stream.
public HttpEntityStream(HttpContent content, MediaTypeFormatter serializer, string separator, int bufferSize)
Parameters
contentHttpContentThe HTTP body.
serializerMediaTypeFormatterUsed to deserialize entities in the body.
separatorstringThe character sequence used to detect that a new element starts in an HTTP stream.
bufferSizeintThe size of the buffer used to collect data for deserialization in bytes.
Methods
GetNextAsync(CancellationToken)
Retrieves the next entity from the stream.
public Task<TEntity> GetNextAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationTokenUsed to cancel the request.
Returns
- Task<TEntity>
Exceptions
- EndOfStreamException
The stream has ended and there are no further entities.
- TaskCanceledException
The
cancellationTokenwas triggered.