Table of Contents

Class RetryableCopyToStreamTask

Namespace
Hi3Helper.Plugin.Core.Utility
Assembly
Hi3Helper.Plugin.Core.dll

Runs a retry-able task of Copy-to routine from Source to Target Stream.
This is suitable for Copy-to operation which involves a Stream from network related instances (for example: HttpClient) whether as source or target or both.

public class RetryableCopyToStreamTask : IDisposable, IAsyncDisposable
Inheritance
RetryableCopyToStreamTask
Implements
Inherited Members

Methods

CreateTask(SourceStreamFactory, Stream, RetryableCopyToStreamTaskOptions?)

Creates an instance of RetryableCopyToStreamTask.

public static RetryableCopyToStreamTask CreateTask(RetryableCopyToStreamTask.SourceStreamFactory sourceStreamFactory, Stream targetStream, RetryableCopyToStreamTaskOptions? options = null)

Parameters

sourceStreamFactory RetryableCopyToStreamTask.SourceStreamFactory

An asynchronous callback to create a source Stream to copy from.

targetStream Stream

The stream in which the data will be copied to.

options RetryableCopyToStreamTaskOptions

Sets of parameters given to run the task.

Returns

RetryableCopyToStreamTask

An instance of RetryableCopyToStreamTask.

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Dispose()

DisposeAsync()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources asynchronously.

public ValueTask DisposeAsync()

Returns

ValueTask

A task that represents the asynchronous dispose operation.

StartTaskAsync(ReadDelegate?, CancellationToken)

Starts the Copy-to Task asynchronously.

public ValueTask StartTaskAsync(RetryableCopyToStreamTask.ReadDelegate? readDelegate = null, CancellationToken token = default)

Parameters

readDelegate RetryableCopyToStreamTask.ReadDelegate

A delegate which gets how many bytes being read from the source Stream.

token CancellationToken

Cancellation token for the task.

Returns

ValueTask

An asynchronous task of the Copy-to routine.