20 namespace Deveel.Data.Util {
22 public static void CopyTo(
this Stream source, Stream destination) {
23 CopyTo(source, destination, 2048);
26 public static void CopyTo(
this Stream source, Stream destination,
int bufferSize) {
28 throw new ArgumentNullException(
"source");
29 if (destination == null)
30 throw new ArgumentNullException(
"destination");
33 throw new ArgumentException(
"The source stream cannot be read.");
34 if (!destination.CanWrite)
35 throw new ArgumentException(
"The destination stream cannot be write");
37 var buffer =
new byte[bufferSize];
40 while ((readCount = source.Read(buffer, 0, bufferSize)) != 0) {
41 destination.Write(buffer, 0, readCount);
static void CopyTo(this Stream source, Stream destination, int bufferSize)
static void CopyTo(this Stream source, Stream destination)