System.Classes.TCustomMemoryStream.SaveToStream

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

procedure SaveToStream(Stream: TStream); virtual;

C++

virtual void __fastcall SaveToStream(TStream* Stream);

Properties

Type Visibility Source Unit Parent
procedure
function
public
System.Classes.pas
System.Classes.hpp
System.Classes TCustomMemoryStream

Description

Writes the entire contents of the memory stream to the stream object specified by 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.

See Also