XenAdmin.Actions.ZipStatusReportAction.CopyStream C# (CSharp) Method

CopyStream() private static method

Copies the specified number of bytes from one stream to another via the provided buffer.
private static CopyStream ( Stream inputStream, Stream outputStream, long bytesToCopy, byte buf ) : void
inputStream Stream
outputStream Stream
bytesToCopy long
buf byte
return void
        private static void CopyStream(Stream inputStream, Stream outputStream, long bytesToCopy, byte[] buf)
        {
            while (bytesToCopy > 0)
            {
                int bytesRead = inputStream.Read(buf, 0, Math.Min(bytesToCopy > int.MaxValue ? int.MaxValue : (int)bytesToCopy, buf.Length));
                outputStream.Write(buf, 0, bytesRead);
                bytesToCopy -= bytesRead;
            }
        }