I don't understand what the problem is.
The code:
FileStream fs = File.OpenWrite( "blah.dat") ;
fs.Write(ms.Get Buffer(), 0, ms.Position);
fs.Close();
Is pretty damn fast, and short. Any write-based optimizations will be taken
care of by the FileStream implementation and shouldn't be something you have
to worry about.
I think, from a design point of view, it would be wrong to have a SaveToFile
function in the MemoryStream object. The purpose of the MemoryStream is just
that, to provide a stream interface onto a block of memory. The FileStream
writes to files, and so it makes sense to use a FileStream to dump out the
internal buffer of the MemoryStream (which is what GetBuffer() provides) to
a file.
--
John Wood
EMail: first name, dot, last name, at priorganize.com
"Alexander Muylaert" <Re********@pan dora.be> wrote in message
news:eV******** ******@TK2MSFTN GP11.phx.gbl...
Hi guys
Are you seriously telling me that there is no way I can write the
internall array fast to a file?
No optimized routine that writes a memorystream in blocks to a file?
In Delphi you have TMemorystream.S aveToFile.
This actually writes the memorystream to file, optimized for disk
performance. (blocks of 8 k etc..)
Kind regards
Alexander