Table of Contents

Class HttpResponseStreamProvider

Namespace
CarinaStudio.Net.Http
Assembly
CarinaStudio.AppBase.Core.dll

Implementation of IStreamProvider which send HTTP request and get Stream of response.

public class HttpResponseStreamProvider : BaseDisposable, IDisposable, IStreamProvider
Inheritance
HttpResponseStreamProvider
Implements
Inherited Members
Extension Methods

Constructors

HttpResponseStreamProvider(Func<HttpRequestMessage>, TimeSpan?, HttpMessageHandler?, long?)

Initialize new HttpResponseStreamProvider instance.

Function to provide HttpRequestMessage. Timeout of getting HTTP response. The HTTP handler stack to use for sending requests. Maximum buffer size for response content.
public HttpResponseStreamProvider(Func<HttpRequestMessage> requestProvider, TimeSpan? timeout = null, HttpMessageHandler? messageHandler = null, long? maxResponseContentBufferSize = null)

Parameters

requestProvider Func<HttpRequestMessage>
timeout TimeSpan?
messageHandler HttpMessageHandler
maxResponseContentBufferSize long?

Methods

CheckStreamAccess(StreamAccess)

Check whether given access to Stream is supported by this provider or not.

public bool CheckStreamAccess(StreamAccess access)

Parameters

access StreamAccess

Access to stream.

Returns

bool

True if given combination of access is supported.

Dispose(bool)

Called to dispose instance.

protected override void Dispose(bool disposing)

Parameters

disposing bool

True to release managed resources also.

OpenStreamAsync(StreamAccess, CancellationToken)

Open stream asynchronously.

public Task<Stream> OpenStreamAsync(StreamAccess access, CancellationToken token)

Parameters

access StreamAccess

Desired access to stream.

token CancellationToken

Cancellation token.

Returns

Task<Stream>

Task of opening stream.