iText 8.0.2 API
iText.Commons.Utils.ZipFileReader Class Reference

Allows reading entries from a zip file. More...

Inheritance diagram for iText.Commons.Utils.ZipFileReader:

Public Member Functions

  ZipFileReader (String archivePath)
  Creates an instance for zip file reading. More...
 
ISet< String >  GetFileNames ()
  Get all file entries paths inside the reading zip file. More...
 
Stream  ReadFromZip (String fileName)
  Read single file from zip. More...
 
void  SetThresholdSize (int thresholdSize)
  Sets the maximum total uncompressed data size to prevent a Zip Bomb Attack. Default value is 1 GB (1000000000). More...
 
void  SetThresholdEntries (int thresholdEntries)
  Sets the maximum number of file entries in the archive to prevent a Zip Bomb Attack. Default value is 10000. More...
 
void  SetThresholdRatio (double thresholdRatio)
  Sets the maximum ratio between compressed and uncompressed data to prevent a Zip Bomb Attack. In general the data compression ratio for most of the legit archives is 1 to 3. Default value is 10. More...
 
void  Dispose ()
 

Detailed Description

Allows reading entries from a zip file.

Constructor & Destructor Documentation

◆ ZipFileReader()

iText.Commons.Utils.ZipFileReader.ZipFileReader ( String  archivePath )
inline

Creates an instance for zip file reading.

Parameters
archivePath the path to the zip file to read
Exceptions
IOException if some I/O exception occurs

Member Function Documentation

◆ GetFileNames()

ISet iText.Commons.Utils.ZipFileReader.GetFileNames ( )
inline

Get all file entries paths inside the reading zip file.

Returns
the Set of all file entries paths
Exceptions
IOException if some I/O exception occurs

◆ ReadFromZip()

Stream iText.Commons.Utils.ZipFileReader.ReadFromZip ( String  fileName )
inline

Read single file from zip.

Parameters
fileName the file path inside zip to read
Returns
the InputStream represents read file content
Exceptions
IOException if some I/O exception occurs

◆ SetThresholdEntries()

void iText.Commons.Utils.ZipFileReader.SetThresholdEntries ( int  thresholdEntries )
inline

Sets the maximum number of file entries in the archive to prevent a Zip Bomb Attack. Default value is 10000.

Parameters
thresholdEntries maximum number of file entries in the archive

◆ SetThresholdRatio()

void iText.Commons.Utils.ZipFileReader.SetThresholdRatio ( double  thresholdRatio )
inline

Sets the maximum ratio between compressed and uncompressed data to prevent a Zip Bomb Attack. In general the data compression ratio for most of the legit archives is 1 to 3. Default value is 10.

Parameters
thresholdRatio maximum ratio between compressed and uncompressed data

◆ SetThresholdSize()

void iText.Commons.Utils.ZipFileReader.SetThresholdSize ( int  thresholdSize )
inline

Sets the maximum total uncompressed data size to prevent a Zip Bomb Attack. Default value is 1 GB (1000000000).

Parameters
thresholdSize the threshold for maximum total size of the uncompressed data