VCLZip


VCLZip is a popular Compression component written by Kevin Bolyan VCLZip@bigfoot.com

 

It comes with full source and is only $49 and fully supports the ZIP file format.

 

 

 

It is thread safe and can be found at

http://www.bigfoot.com/~vclzip

 

Here are some routines that may help in using VCLZIP with ASTA.

 

 

 

Function VCLZipCompressStream(m:TMemoryStream):TMemoryStream;

var

z:TVclZip;

begin

 m.Position:=0;

 z:=TVCLZip.Create(nil);

 try

  result:=TMemoryStream.create;

  z.packlevel:=1; //sets speed compression see vcl zip help

  z.ArchiveSTream:=result;

  Z.ZipfromSTream(m,'test');

  z.archivestream:=nil;

  finally

   z.free;

end;

end;

 

Function VCLZipDeCompressStream(m:TMemoryStream):TMemoryStream;

var

z:TVclUnZip;

begin

 m.Position:=0;

 z:=TVCLUnZip.Create(nil);

 try

  result:=TMemoryStream.create;

  z.ArchiveStream:=m;

  Z.UnZipToStream(result,'test');

  result.position:=0;

  z.archivestream:=nil;

  finally

   z.free;

end;

end;

 

Function VCLZipStringCompress(S:String):String;

var

m,m1:TMemoryStream;

begin

 m:=NewStringToStream(s);

 m1:=VCLZipCompressStream(m);

 try

  result:=StreamToString(m1);

  finally

  m1.free;

  m.free;

 end;

end;

 

Function VCLZipStringDeCompress(S:String):String;

var

m,m1:TMemoryStream;

begin

 m:=NewStringToStream(s);

 m1:=VCLZipDeCompressStream(m);

 try

  result:=StreamToString(m1);

  finally

  m1.free;

  m.free;

 end;

end;

 

 



ASTA Overview