RAD Studio VCL Reference
TCustomMemoryStream.SaveToStream Method

Writes the entire contents of the memory stream to the stream object specified by Stream.

procedure SaveToStream(Stream: TStream);
__fastcall SaveToStream(TStream Stream);

Use SaveToStream to copy data that is stored in memory into another storage medium. SaveToStream writes the entire contents of Memory into the indicated stream object, starting at the current position in the stream that was passed as a parameter. 

When the Stream parameter is a TFileStream object, SaveToStream does much the same thing as the SaveToFile method. However, SaveToStream writes to the current position in the target stream. Thus, for example, SaveToStream can be used to append the contents of Memory to a file stream, rather than replace the contents of the file the way SaveToFile does. 

If the entire contents of the memory stream cannot be written to the target stream, SaveToStream raises an EWriteError exception. 


Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!