Contents - Index - Previous - Next


UnZipToStreamByIndex method

 

Applies to

TVCLUnZip component

 

Declaration

function UnZipToStreamByIndex(theStream: TkpStream; Index: Integer): Integer;

// D4, D5, BCB4, and BCB5 only...

function UnZipToStreamByIndex(theStream: TStream; Index: Integer): Integer; overload;

 

Description

The UnZipToStreamByIndex method is the same as the UnZipToStream Method except that you pass in the Index instead of the filename of the file to be unzipped.  It unzips the file specified by the Index parameter from the zip file specified by the ZipName Property or from the ArchiveStream, directly to the stream specified by theStream parameter.

  

For example the following will unzip the first .TXT file in the archive:  

 

myStream := TMemoryStream.Create; 

While i < Count do 

If UpperCase(ExtractFileExt(Filename[i])) = '.TXT' then 

begin 

UnZiptoStreamByIndex( myStream, i ); 

break; 

end; 

 

The overloaded version of this method that is defined for D4, D5, BCB4, and BCB5 only, allows these versions of Delphi/BCB to unzip to a normal TStream.  Note that you should not do this if there is a chance that the file you are unzipping might be larger than 2 gig in size since TStreams in these versions do not handle files larger than this.  Remember that in D6, D7, and BCB6, TkpStream = TStream as in these versions of Delphi/BCB TStreams have Int64 capabilities.