diff options
| author | Luke <luke.pulverenti@gmail.com> | 2016-10-12 15:43:28 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-10-12 15:43:28 -0400 |
| commit | 25ef9777cafee83c46ff53ede2caa04e3295e98a (patch) | |
| tree | 5f1e6045d0b4d4d5b7d8dcaadf035b326f36e672 /MediaBrowser.Common.Implementations/IO/MemoryStreamProvider.cs | |
| parent | 0677d4ec990aee9a3bf7bda39dda01eb6fa66281 (diff) | |
| parent | 5be6cf05e34459a046aceaa16c891f3034859476 (diff) | |
Merge pull request #2224 from MediaBrowser/beta
Beta
Diffstat (limited to 'MediaBrowser.Common.Implementations/IO/MemoryStreamProvider.cs')
| -rw-r--r-- | MediaBrowser.Common.Implementations/IO/MemoryStreamProvider.cs | 31 |
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); + } + } +} |
