C# Class System.Net.Http.StreamToStreamCopy

Helper class is used to copy the content of a source stream to a destination stream, with optimizations based on expected usage within HttpClient and with the ability to dispose of the source stream when the copy has completed.
Mostra file Open project: dotnet/corefx Class Usage Examples

Public Methods

Method Description
CopyAsync ( Stream source, Stream destination, int bufferSize, bool disposeSource, CancellationToken cancellationToken = default(CancellationToken) ) : Task

Copies the source stream from its current position to the destination stream at its current position.

Private Methods

Method Description
DisposeSource ( Stream source ) : void

Disposes the source stream if disposeSource is true.

DisposeSourceWhenCompleteAsync ( Task task, Stream source ) : Task

Method Details

CopyAsync() public static method

Copies the source stream from its current position to the destination stream at its current position.
public static CopyAsync ( Stream source, Stream destination, int bufferSize, bool disposeSource, CancellationToken cancellationToken = default(CancellationToken) ) : Task
source System.IO.Stream The source stream from which to copy.
destination System.IO.Stream The destination stream to which to copy.
bufferSize int The size of the buffer to allocate if one needs to be allocated.
disposeSource bool Whether to dispose of the source stream after the copy has finished successfully.
cancellationToken System.Threading.CancellationToken CancellationToken used to cancel the copy operation.
return Task