aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Common.Implementations/IO/MemoryStreamProvider.cs
diff options
context:
space:
mode:
authorhatharry <hatharry@hotmail.com>2016-10-11 17:21:21 +1300
committerhatharry <hatharry@hotmail.com>2016-10-11 17:21:21 +1300
commitd6862cefd83e3733a7a459ffd7cec616db006c22 (patch)
treea712bbef2227b60d8d870898e4205328fbf02484 /MediaBrowser.Common.Implementations/IO/MemoryStreamProvider.cs
parent91225bc9688327e89224c91651dcec7eafa05234 (diff)
parent9b0ac4bde5beb74703a258d582f477c6411ec6ec (diff)
Merge branch 'dev' of https://github.com/hatharry/Emby.git
Diffstat (limited to 'MediaBrowser.Common.Implementations/IO/MemoryStreamProvider.cs')
-rw-r--r--MediaBrowser.Common.Implementations/IO/MemoryStreamProvider.cs31
1 files changed, 31 insertions, 0 deletions
diff --git a/MediaBrowser.Common.Implementations/IO/MemoryStreamProvider.cs b/MediaBrowser.Common.Implementations/IO/MemoryStreamProvider.cs
new file mode 100644
index 000000000..364055283
--- /dev/null
+++ b/MediaBrowser.Common.Implementations/IO/MemoryStreamProvider.cs
@@ -0,0 +1,31 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using MediaBrowser.Common.IO;
+using Microsoft.IO;
+
+namespace MediaBrowser.Common.Implementations.IO
+{
+ public class MemoryStreamProvider : IMemoryStreamProvider
+ {
+ readonly RecyclableMemoryStreamManager _manager = new RecyclableMemoryStreamManager();
+
+ public MemoryStream CreateNew()
+ {
+ return _manager.GetStream();
+ }
+
+ public MemoryStream CreateNew(int capacity)
+ {
+ return _manager.GetStream("RecyclableMemoryStream", capacity);
+ }
+
+ public MemoryStream CreateNew(byte[] buffer)
+ {
+ return _manager.GetStream("RecyclableMemoryStream", buffer, 0, buffer.Length);
+ }
+ }
+}