TSubstringList.ChunkSize Property

property ChunkSize: Integer read FChunkSize write SetChunkSize;

The size of the pieces a load or save converts: ChunkSize bytes read, or ChunkSize div 2 characters written; 128 KB by default.

Returns: Integer

Remarks:

From 4 to 536870912 (512 MB); setting a value outside raises ESubstringRangeError.

Examples

The smallest pieces read every line.

uses Substr, System.SysUtils, System.Classes;

procedure Example;
var List: TSubstringList;
    Stream: TBytesStream;
begin
    List := TSubstringList.Create(2);
    Stream := TBytesStream.Create;
    try
        List.Add('first line');
        List.Add('second line');
        List.SaveToStream(Stream, TEncoding.UTF8);
        Stream.Position := 0;
        List.ChunkSize := 4;
        List.LoadFromStream(Stream);
        Assert((List.Count = 2) and (List[1] = 'second line'));
    finally
        Stream.Free;
        List.Free;
    end;
end;
See Also: TSubstringList.LoadFromStream, TSubstringList.LoadFromStream, TSubstringList.SaveToStream, TSubstringList.SaveToStream