aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Common.Implementations/IO/MemoryStreamProvider.cs
diff options
context:
space:
mode:
authorLuke <luke.pulverenti@gmail.com>2016-10-06 14:55:55 -0400
committerGitHub <noreply@github.com>2016-10-06 14:55:55 -0400
commitce9574f562f67adf485debe324881b1cf3dd8ee8 (patch)
tree05ea4b3875453b76cd4c7ba7e0079481a5e225db /MediaBrowser.Common.Implementations/IO/MemoryStreamProvider.cs
parentd588620d3a4abcbe785f50380be749ff6d825a3a (diff)
parenta69ca6c55bb7183d247c2c3b25203dbed99fd5d9 (diff)
Merge pull request #2211 from MediaBrowser/dev
Dev
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);
+ }
+ }
+}