Hi,
I am downloading a XZ compressed file from the internet and wish to extract the file to work with the contained XML file, however, something doesn't seem to work as excepted
The file is perfectly downloaded and can be extracted/decompressed by WinRAR etc...
uses .....,BZip2Lib;
procedure TForm1.DecompressMyExternalXZfile(aFilename: String);
var
InFileStream : TFileStream;
DecompressStream : TBzip2DecompressStream;
XZmemo: TMemo;
begin
AddLogLine(FormatDateTime('YYYY-MM-DD HH:NN:SS',Now())+' - XZ decompression started', clBlack);
XZmemo := TMemo.Create(nil);
InFileStream := TFileStream.Create(aFilename, fmOpenRead);
DecompressStream := TBzip2DecompressStream.Create(InFileStream);
try
XZmemo.Lines.LoadFromStream(DecompressStream);
XZmemo.Lines.SaveToFile(copy(aFilename, 1, Length(aFilename)-3)); // Remove .xz from filename
finally
DecompressStream.Free;
InFileStream.Free;
XZmemo.Free;
end;
AddLogLine(FormatDateTime('YYYY-MM-DD HH:NN:SS',Now())+' - XZ decompressed', clBlack);
end;
The error I get is: Stream read error
Any help is really appreciated