MemoryOutputStream Y U NO let me pass buffer?

Unlike MemoryInputStream, MemoryOutputStream does not let me pass my own void const* and a size_t to indicate where to put the data!


Well, my reason for that was that the output stream was always designed to keep expanding and not have a fixed size. It’s a good request though, and easy to add, so I’ll sort that out for you…

FWIW, i use a different pattern for this.

For a number of juce datastructures (eg MemoryBlock) i put in my consume' anddonate’ pattern.

For example consume(void* data, int size)' andvoid* donate(int& size)’ work to put memory in and out of data structures so to avoid copies. This is useful when you know the data is really big.

Well the thing is I have a piece of already existing memory and I want to use the streams to do serialization and deserialization in network byte order (i.e. big-endian). So its very nice to use the streams for that.