[delphizip] Re: ExtractStreamToStream

  • From: "Werner Kok" <werner@xxxxxxxxxxxxxxxxx>
  • To: <delphizip@xxxxxxxxxxxxx>
  • Date: Wed, 23 Feb 2005 15:26:33 +0200

Hi Gerard,

Thanks for the reply.

My file is now no more empty but the "extracted" contents is still the
zipped data??

Please look at what I'm doing below and help my frustrated soul, I will be
forever gratefull!


procedure TForm1.Button1Click(Sender: TObject);
var FileData: TMemoryStream;
    MyData: TMemoryStream;
    MyOutData: TZipStream;
    Buf1: Array[1..6] of Byte;

begin

FileData := TMemoryStream.Create;
FileData.Position := 0;
FileData.LoadFromFile('c:\Example.zip');

MyData := TMemoryStream.Create;
MyData.Position := 0;
Buf1[1] := 0;
Buf1[2] := 0;
Buf1[3] := 9;
Buf1[4] := 9;
Buf1[5] := 9;
Buf1[6] := 9;
MyData.Write(Buf1,6);
MyData.Position := 6;
MyData.CopyFrom(FileData,0);
MyData.Position := 0;

MyOutData := ZipMaster1.ExtractStreamToStream(MyData, 32768);
MyOutData.Position := 0;
MyOutData.SaveToFile('c:\Extracted.txt');

end;


Why oh why is the file 'c:\Extracted.txt' still the compressed zip file?




Thank you so much!,

Werner Kok


-----Original Message-----
From: delphizip-bounce@xxxxxxxxxxxxx
[mailto:delphizip-bounce@xxxxxxxxxxxxx]On Behalf Of Gerard
Sent: 23 February 2005 03:05 PM
To: delphizip@xxxxxxxxxxxxx
Subject: [delphizip] Re: ExtractStreamToStream


Hi Werner,

Maybe the you need set to set xxStream.Position := 0 before you save the
ZipStream into another stream.
After writing to your stream, the postion is probably at the end and you
need to set it back to the beginning
before you save it into a filestream

HTH,
Gerard.

At 01:41 p.m. 23/02/2005, you wrote:


>Hi there,
>
>Please help, I'm having endless troubles with the ExtractStreamToStream
>method. What I need is to extract a zip stream directly that was not
>inititialy created by TZipMaster. So it does not have the first 6 bytes as
>is mentioned in the help.
>
>Please send me code examples of how I go about doing this, because I don't
>receive any error, but after the ExtractStreamToStream  is executed, I save
>the contents of  TZipStream to a file only to discover that the file is
zero
>bytes in size!
>
>ANY help will be greatly appreciated!!!! Thanks for this free component!
>
>Werner Kok


--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 266.2.0 - Release Date: 21/02/2005


-----------
To unsubscribe from this list, send an empty e-mail
message to:
  delphizip-request@xxxxxxxxxxxxx
and put the word unsubscribe in the subject.

-----------
To unsubscribe from this list, send an empty e-mail 
message to:
  delphizip-request@xxxxxxxxxxxxx 
and put the word unsubscribe in the subject.

Other related posts: