2016-12-23 21:45:24 +00:00
|
|
|
|
using System.IO;
|
2014-03-20 07:08:15 +00:00
|
|
|
|
|
|
|
|
|
namespace NzbDrone.Common.Extensions
|
|
|
|
|
{
|
|
|
|
|
public static class StreamExtensions
|
|
|
|
|
{
|
|
|
|
|
public static byte[] ToBytes(this Stream input)
|
|
|
|
|
{
|
|
|
|
|
var buffer = new byte[16 * 1024];
|
|
|
|
|
using (var ms = new MemoryStream())
|
|
|
|
|
{
|
|
|
|
|
int read;
|
|
|
|
|
while ((read = input.Read(buffer, 0, buffer.Length)) > 0)
|
|
|
|
|
{
|
|
|
|
|
ms.Write(buffer, 0, read);
|
|
|
|
|
}
|
2020-01-03 12:49:24 +00:00
|
|
|
|
|
2014-03-20 07:08:15 +00:00
|
|
|
|
return ms.ToArray();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|