Create infinite sized RamStream?

BlitzMax Forums/BlitzMax Programming/Create infinite sized RamStream?

plash(Posted 2008) [#1]
I need to write data into a stream, but not a file, and the data will be of unknown length (there are a multiple number of variable-sized fields which need to be saved.)

The only way you can create a TRamStream is by using a known/finite size of ram (one that works, that is); is there a way to just *open* some ram and have it change in size as you write to it?

EDIT: The data will be encrypted after writing to the ramstream, thus the need for it to be in the ram and not on the HD as a temporary file.

EDIT2: It would probably be easy to do it with a string, but not as fast (imo) as writing variables directly to a stream.


grable(Posted 2008) [#2]
Heres something i made many moons ago.
Its not thoroughly tested, and it doesnt scale to very large sizes as it reallocates the new size and copies the date over.
BUt it should you an idea as to how to do it.



Perturbatio(Posted 2008) [#3]
Can you use a BankStream?


plash(Posted 2008) [#4]
Oh snap.. I always seem to forget about Banks.. Thanks! - I was just about to use grable's code (which works quite well.)


Perturbatio(Posted 2008) [#5]
np :)