test/Shared/FunctionalTests.Transitional/TestHelpers/IOHelpers.cs
/// <summary>
/// Copies contents of one stream into another.
/// </summary>
/// <param name="source"> Stream to read from. </param>
/// <param name="destination"> Stream to write to. </param>
/// <param name="copyBuffer"> The copy buffer. </param>
/// <returns> The number of bytes copied from the source. </returns>
Copies contents of one stream into another.
Copies contents of one stream into another .
public static int CopyStream(Stream source, Stream destination, byte[] copyBuffer)
        {
            ExceptionHelpers.CheckArgumentNotNull(source, "source");
            ExceptionHelpers.CheckArgumentNotNull(destination, "destination");
            ExceptionHelpers.CheckArgumentNotNull(copyBuffer, "copyBuffer");
            var bytesCopied = 0;
            int bytesRead;
            do
            {
                bytesRead = source.Read(copyBuffer, 0, copyBuffer.Length);
                destination.Write(copyBuffer, 0, bytesRead);
                bytesCopied += bytesRead;
            }
            while (bytesRead != 0);
            return bytesCopied;
        }
public static int CopyStream ( Stream source , Stream destination , byte [ ] copyBuffer ) { ExceptionHelpers . CheckArgumentNotNull ( source , " " ) ; ExceptionHelpers . CheckArgumentNotNull ( destination , " " ) ; ExceptionHelpers . CheckArgumentNotNull ( copyBuffer , " " ) ; var bytesCopied = 0 ; int bytesRead ; do { bytesRead = source . Read ( copyBuffer , 0 , copyBuffer . Length ) ; destination . Write ( copyBuffer , 0 , bytesRead ) ; bytesCopied += bytesRead ; } while ( bytesRead != 0 ) ; return bytesCopied ; }
Copies contents of one stream into another.
Copies contents of one stream into another .
The number of bytes copied from the source.
The number of bytes copied from the source .
source
Stream
Stream to read from.
Stream to read from .
destination
Stream
Stream to write to.
Stream to write to .
copyBuffer
byte[]
The copy buffer.
The copy buffer .