public class ZipFileReader extends Object implements Closeable
| Constructor and Description |
|---|
ZipFileReader(String archivePath)
Creates an instance for zip file reading.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
Set<String> |
getFileNames()
Get all file entries paths inside the reading zip file.
|
InputStream |
readFromZip(String fileName)
Read single file from zip.
|
void |
setThresholdEntries(int thresholdEntries)
Sets the maximum number of file entries in the archive to prevent a Zip Bomb Attack.
|
void |
setThresholdRatio(double thresholdRatio)
Sets the maximum ratio between compressed and uncompressed data to prevent a Zip Bomb Attack.
|
void |
setThresholdSize(int thresholdSize)
Sets the maximum total uncompressed data size to prevent a Zip Bomb Attack.
|
public ZipFileReader(String archivePath) throws IOException
archivePath - the path to the zip file to readIOException - if some I/O exception occurspublic Set<String> getFileNames() throws IOException
Set of all file entries pathsIOException - if some I/O exception occurspublic InputStream readFromZip(String fileName) throws IOException
fileName - the file path inside zip to readInputStream represents read file contentIOException - if some I/O exception occurspublic void setThresholdSize(int thresholdSize)
thresholdSize - the threshold for maximum total size of the uncompressed datapublic void setThresholdEntries(int thresholdEntries)
thresholdEntries - maximum number of file entries in the archivepublic void setThresholdRatio(double thresholdRatio)
thresholdRatio - maximum ratio between compressed and uncompressed datapublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionCopyright © 1998–2025 Apryse Group NV. All rights reserved.