System.Classes.TStrings.SaveToStream
Delphi
procedure SaveToStream(Stream: TStream); overload; virtual;
procedure SaveToStream(Stream: TStream; Encoding: TEncoding); overload; virtual;
C++
virtual void __fastcall SaveToStream(TStream* Stream)/* overload */;
virtual void __fastcall SaveToStream(TStream* Stream, System::Sysutils::TEncoding* Encoding)/* overload */;
Properties
Type | Visibility | Source | Unit | Parent |
---|---|---|---|---|
procedure function |
public | System.Classes.pas System.Classes.hpp |
System.Classes | TStrings |
Description
Writes the value of the Text property to the Stream
stream.
SaveToStream gets all strings from the current TStrings object and combines them into the single string containing these strings delimited by LineBreak sequence. Then SaveToStream encodes this string using the specified Encoding
. Then SaveToStream writes the encoded string into the specified Stream
stream.
If WriteBOM is True
then SaveToStream first gets the preamble of the specified Encoding
or of the DefaultEncoding (if Encoding
= nil
) and writes the preamble bytes into the stream before the main string.
If the Encoding
parameter is not given, then the strings are saved with the encoding specified in the Encoding property.
True
, then SaveToStream writes a finishing line break LineBreak after the last string.If the stream is a file stream, SaveToStream does the same thing as SaveToFile, except that SaveToFile creates and destroys the file stream.
See Also
- System.Classes.TStrings.LoadFromStream
- System.Classes.TStrings.SaveToFile
- System.Classes.TStrings.Encoding
- System.Classes.TStrings.Strings
- System.Classes.TStrings.Text
- System.Classes.TStrings.LineBreak
- System.Classes.TStrings.TrailingLineBreak
- System.Classes.TStrings.WriteBOM
- System.SysUtils.TEncoding.GetPreamble