Class HttpEntityStream<TEntity>
Exposes an HTTP body as a stream of deserialized entities.
public class HttpEntityStream<TEntity>
Type Parameters
TEntity
The 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
content
HttpContentThe HTTP body.
serializer
MediaTypeFormatterUsed to deserialize entities in the body.
separator
stringThe character sequence used to detect that a new element starts in an HTTP stream.
bufferSize
intThe 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
cancellationToken
CancellationTokenUsed to cancel the request.
Returns
- Task<TEntity>
Exceptions
- EndOfStreamException
The stream has ended and there are no further entities.
- TaskCanceledException
The
cancellationToken
was triggered.