CopyAsync() 공개 정적인 메소드

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.
리턴 Task
예제 #1
0
        protected override Task SerializeToStreamAsync(Stream stream, TransportContext context)
        {
            Debug.Assert(stream != null);

            PrepareContent();
            // If the stream can't be re-read, make sure that it gets disposed once it is consumed.
            return(StreamToStreamCopy.CopyAsync(_content, stream, _bufferSize, !_content.CanSeek));
        }
예제 #2
0
 private Task SerializeToStreamAsyncCore(Stream stream, CancellationToken cancellationToken)
 {
     Debug.Assert(stream != null);
     PrepareContent();
     return(StreamToStreamCopy.CopyAsync(
                _content,
                stream,
                _bufferSize,
                !_content.CanSeek, // If the stream can't be re-read, make sure that it gets disposed once it is consumed.
                cancellationToken));
 }
예제 #3
0
 private Task SerializeToStreamAsyncCore(Stream stream, CancellationToken cancellationToken)
 {
     this.PrepareContent();
     return(StreamToStreamCopy.CopyAsync(this._content, stream, this._bufferSize, !this._content.CanSeek, cancellationToken));
 }