jellyfin/Emby.Server.Implementations/IO/MemoryStreamProvider.cs
2017-08-16 11:42:36 -04:00

30 lines
666 B
C#

using System.IO;
using MediaBrowser.Model.IO;
namespace Emby.Server.Implementations.IO
{
public class MemoryStreamProvider : IMemoryStreamFactory
{
public MemoryStream CreateNew()
{
return new MemoryStream();
}
public MemoryStream CreateNew(int capacity)
{
return new MemoryStream(capacity);
}
public MemoryStream CreateNew(byte[] buffer)
{
return new MemoryStream(buffer);
}
public bool TryGetBuffer(MemoryStream stream, out byte[] buffer)
{
buffer = stream.GetBuffer();
return true;
}
}
}