IntroductionMemoryTributary is a MemoryStream replacement using multiple memory segments to store the content of the stream, as opposed to the single byte array of MemoryStream. It is designed to be a complete replacement, capable of handling the large datasets that MemoryStream cannot.
Why use MemoryTributary?This article
http://www.codeproject.com/Articles/348590/A-replacement-for-MemoryStream contains a full explanation of the issue that MemoryTributary is attempting to solve, but in summary:
- MemoryTributary makes more efficient use of available address space, allowing for larger streams.
- MemoryTributary never has to re-allocate or copy memory, making it more efficient when writing.
Getting & Using MemoryTributaryMemoryTributary derives from Stream and can be used anywhere a Stream can.
The source consists of just one file (get this from Source Code), MemoryTributary.cs: copy this into your project, compile and go!