Table of Contents

Class HttpEntityStream<TEntity>

Namespace
TypedRest.Http
Assembly
TypedRest.Reactive.dll

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 HttpContent

The HTTP body.

serializer MediaTypeFormatter

Used to deserialize entities in the body.

separator string

The character sequence used to detect that a new element starts in an HTTP stream.

bufferSize int

The 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 CancellationToken

Used to cancel the request.

Returns

Task<TEntity>

Exceptions

EndOfStreamException

The stream has ended and there are no further entities.

TaskCanceledException

The cancellationToken was triggered.