TSubstringListInvariant.SaveToStream Method

Overload List

#SignatureDescription
1procedure SaveToStream(const Stream: TStream); overload;Writes Text to Stream in Encoding (the encoding of the last load), else DefaultEncoding.
2procedure SaveToStream(const Stream: TStream; const Encoding: TEncoding); overload;Writes Text to Stream at its position in Encoding, after the encoding's byte order mark while WriteBOM; nil writes in DefaultEncoding.

Overload 1: procedure SaveToStream(const Stream: TStream); overload;

Writes Text to Stream in Encoding (the encoding of the last load), else DefaultEncoding.

#NameDescription
1Stream

The stream, written at its position.

Result: stored in self (calling object)

Remarks:

As SaveToStream(Stream, Encoding) otherwise.

Examples
var b: Matrix;
    AStream: TFileStream;
begin
    b := [[0,0,1,3,2]];
    AStream := TFileStream.Create('C:\test.Vec',fmCreate);
    try
        b.SaveToStream(AStream); // Write info and header for b
    finally
        AStream.Free;
    end
end;

Overload 2: procedure SaveToStream(const Stream: TStream; const Encoding: TEncoding); overload;

Writes Text to Stream at its position in Encoding, after the encoding's byte order mark while WriteBOM; nil writes in DefaultEncoding.

#NameDescription
1Stream

The stream, written at its position.

2Encoding

The encoding to write in; nil writes in DefaultEncoding.

Result: stored in self (calling object)

Remarks:

No string is built. For UTF-8, UTF-16, and TEncoding.ANSI or TEncoding.ASCII on a single-byte code page, the items are converted ChunkSize bytes of text at a time, in memory of about two and a half times ChunkSize, whatever the number of items. Any other encoding converts the whole text at once. The list keeps that memory for its next save or load, which takes more only for more text, until Compact. A text the encoding cannot write raises EEncodingError; what was written before it stays in the stream.