andrew4582

CopyStreams

Nov 13th, 2010
277
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.46 KB | None | 0 0
  1.         public static void CopyStreams(Stream sourceStream,Stream destStream) {
  2.             if(sourceStream == null)
  3.                 throw new ArgumentNullException("sourceStream");
  4.             if(destStream == null)
  5.                 throw new ArgumentNullException("destStream");
  6.  
  7.             byte[] buffer = new byte[4096];
  8.             for(int len;(len = sourceStream.Read(buffer,0,buffer.Length)) > 0;)
  9.                 destStream.Write(buffer,0,len);
  10.         }
Add Comment
Please, Sign In to add comment