Delphi-Quellcode:
function TLZMAAlone.CompressString(str: String): String;
var
inStream: TStringStream;
outStream: TStringStream;
begin
inStream := TStringStream.Create(str);
outStream := TMemoryStream.Create('');
try
CompressStream(inStream, outStream);
Result := outStream.DataString;
finally
outStream.Free;
inStream.Free;
end;
end;
function TLZMAAlone.DecompressString(str: String): String;
var
inStream: TStringStream;
outStream: TStringStream;
begin
inStream := TStringStream.Create(str);
outStream := TMemoryStream.Create('');
try
DecompressStream(inStream, outStream);
Result := outStream.DataString;
finally
outStream.Free;
inStream.Free;
end;
end;
Egal was CompressStream/DecompressStream macht. Das sollte 'eigentlich' funktionieren.