123456789101112131415161718192021222324 |
- using System;
- using System.IO;
- namespace TriLib
- {
- public static class StreamUtils
- {
- public static byte[] ReadFullStream(Stream stream)
- {
- byte[] array = new byte[4096];
- byte[] result;
- using (MemoryStream memoryStream = new MemoryStream())
- {
- int count;
- while ((count = stream.Read(array, 0, array.Length)) > 0)
- {
- memoryStream.Write(array, 0, count);
- }
- result = memoryStream.ToArray();
- }
- return result;
- }
- }
- }
|