|
Post by Mark Williams on Jan 19, 2004 10:53:49 GMT -5
Hi,
I'm trying out vclZip Lite. I've got it to work well, save for one thing.
I add sreams to the archive stream and I then want to work with the archive stream, which main contain a number of different streams. I can't however, figure out how to work with ArchiveStream.
I need to do two things:
1. Save the ArchiveStream to a file. 2. Send it down a socket.
Any help appreciate.
Regards,
Mark
|
|
|
Post by Kevin on Jan 19, 2004 20:25:13 GMT -5
Something like the following as just a simple example: var MyArchiveStream: TMemoryStream; MyStream: TMemoryStream;
VCLZip.ArchiveStream := TMemoryStream.Create; for i := 0 to 10 do begin // Somehow get your data into myStream // ... // Now zip data in myStream, giving each stream a filename for internal use ZipFromStream(myStream, 'file'+IntToStr(i)); end; // Get the archive stream from VCLZip MyArchiveStream := VCLZip.ArchiveStream; // Detach from VCLZip VCLZip.ArchiveStream := nil;
Now do whatever you want with MyArchiveStream which contains the compressed streams. Save it to a file or send it down a socket. When you want to get files back out of it just attach it to ArchiveStream again and unzip as if it were a normal zip file: VCLZip.ArchiveStream := MyArchiveStream; VCLZip.ReadZip; VCLZip.FilesList.Add('*.*'); VCLZip.UnZip; VCLZip.ArchiveStream := nil;
or if you unzip to streams then you must do them one at a time like: for i := 0 to 5 do begin VCLZip.UnZipToStream(myStream,'file'+IntToStr(i)); end;
|
|