implement TProxyAggregateStream (Delphi compatibility)
See: https://docwiki.embarcadero.com/Libraries/Athens/en/System.Classes.TProxyAggregateStream
Here is a test for the test suite:
program ProxyAggregateStreamTest;
uses
Classes, SysUtils;
var
P: TProxyAggregateStream;
S: RawByteString;
I: Integer;
C: AnsiChar;
begin
P := TProxyAggregateStream.Create;
try
P.AddStream(TRawByteStringStream.Create('0123'), True);
P.AddStream(TRawByteStringStream.Create('45'), True);
P.AddStream(TRawByteStringStream.Create('6'), True);
P.AddStream(TRawByteStringStream.Create('789'), True);
// test concat read
P.Position := 0;
SetLength(S, 10);
if not((P.Read(S[1], 10)=10) and (S='0123456789')) then
Halt(1);
// test seek to position
for I := 0 to P.Size-1 do
begin
P.Position := I;
if not((P.Read(C, 1)=1) and (C=IntToStr(I))) then
Halt(2);
end;
// test seek from end
P.Seek(-1, soEnd);
if not((P.Read(C, 1)=1) and (C=IntToStr(9))) then
Halt(3);
// test remove stream
P.RemoveStream(1);
P.Position := 3;
SetLength(S, 4);
if not((P.Read(S[1], 4)=4) and (S='3678')) then
Halt(4);
finally
P.Free;
end;
end.