2016-10-13 23:13:30 +02:00
|
|
|
|
using System.IO;
|
2016-10-23 21:14:57 +02:00
|
|
|
|
using MediaBrowser.Model.IO;
|
2016-10-06 20:55:01 +02:00
|
|
|
|
|
2017-08-09 21:56:38 +02:00
|
|
|
|
namespace Emby.Server.Implementations.IO
|
2016-10-06 20:55:01 +02:00
|
|
|
|
{
|
2016-11-08 19:44:23 +01:00
|
|
|
|
public class MemoryStreamProvider : IMemoryStreamFactory
|
2016-10-13 23:13:30 +02:00
|
|
|
|
{
|
|
|
|
|
public MemoryStream CreateNew()
|
|
|
|
|
{
|
|
|
|
|
return new MemoryStream();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public MemoryStream CreateNew(int capacity)
|
|
|
|
|
{
|
|
|
|
|
return new MemoryStream(capacity);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public MemoryStream CreateNew(byte[] buffer)
|
|
|
|
|
{
|
|
|
|
|
return new MemoryStream(buffer);
|
|
|
|
|
}
|
2016-11-08 19:44:23 +01:00
|
|
|
|
|
|
|
|
|
public bool TryGetBuffer(MemoryStream stream, out byte[] buffer)
|
|
|
|
|
{
|
|
|
|
|
buffer = stream.GetBuffer();
|
|
|
|
|
return true;
|
|
|
|
|
}
|
2016-10-13 23:13:30 +02:00
|
|
|
|
}
|
2016-10-06 20:55:01 +02:00
|
|
|
|
}
|