namespace JD.Serializers.Stream
{
public static class StreamExtensions
{
///
/// Appends the current stream to the destination stream.
///
///
/// Copying starts from the current position in the source stream.
///
/// Source stream.
/// Destination stream.
public static void AppendTo(this System.IO.Stream srcStream, System.IO.Stream dstStream)
{
const int ChunkSize = 64 * 1024;
byte[] buffer = new byte[ChunkSize];
int bytesRead;
while ((bytesRead = srcStream.Read(buffer, 0, ChunkSize)) > 0)
{
dstStream.Write(buffer, 0, bytesRead);
}
}
}
}