12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- #region Copyright notice and license
- #endregion
- using System;
- using System.IO;
- namespace Google.Protobuf.Compatibility
- {
-
-
-
-
- public static class StreamExtensions
- {
-
- private const int BUFFER_SIZE = 81920;
-
-
-
- public static void CopyTo(this Stream source, Stream destination)
- {
- if (destination == null)
- {
- throw new ArgumentNullException("destination");
- }
- byte[] buffer = new byte[BUFFER_SIZE];
- int numBytesRead;
- while ((numBytesRead = source.Read(buffer, 0, buffer.Length)) > 0) {
- destination.Write(buffer, 0, numBytesRead);
- }
- }
- }
- }
|