Procedure ZLibCompress(Const aSourceStream: TStream;
Var aDestStream: TStream);
Var
Len: Integer;
DecompressionStream: TCompressionStream;
begin
If aSourceStream.Size = 0 then
Exit;
DecompressionStream := TCompressionStream.Create(clDefault, aDestStream);
Try
Len := aSourceStream.Size;
DecompressionStream.Write(Len, SizeOf(Integer));
DecompressionStream.CopyFrom(aSourceStream, Len);
Finally
DecompressionStream.Free;
end;
end;
Procedure ZLibDeCompress(Const aSourceStream: TStream;
Var aDestStream: TStream);
Var
DecompressionStream: TDecompressionStream;
Len: Integer;
begin
DecompressionStream := TDecompressionStream.Create(aSourceStream);
Try
DecompressionStream.Read(Len, SizeOf(Integer));
If Len <> 0 then
aDestStream.CopyFrom(DecompressionStream, Len);
Finally
DecompressionStream.Free;
end;
end;