using System;
using System.Collections.Generic;
using System.Text;
using System.Collections.ObjectModel;
using System.IO;
namespace AntEater.Runtime.Tests.Services.Transformation
{
///
/// Provides a set of Utilities.
///
internal class Utilities
{
///
/// Copies an Stream into another Stream.
///
/// From.
/// To.
/// The buffersize.
/// The number of Bytes copied.
public static long CopyStream(Stream from, Stream to, int buffersize) {
byte[] buffer = new byte[buffersize];
long totalBytesCopied = 0;
int bytesRead = 0;
bytesRead = from.Read(buffer, 0, buffersize);
while(bytesRead > 0){
to.Write(buffer, 0, bytesRead);
totalBytesCopied += bytesRead;
bytesRead = from.Read(buffer, 0, buffersize);
}
return totalBytesCopied;
}
}
}