Class RetryableCopyToStreamTask
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
sourceStreamFactoryRetryableCopyToStreamTask.SourceStreamFactoryAn asynchronous callback to create a source Stream to copy from.
targetStreamStreamThe stream in which the data will be copied to.
optionsRetryableCopyToStreamTaskOptionsSets 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
readDelegateRetryableCopyToStreamTask.ReadDelegateA delegate which gets how many bytes being read from the source Stream.
tokenCancellationTokenCancellation token for the task.
Returns
- ValueTask
An asynchronous task of the Copy-to routine.