public class ZipSecureFile extends ZipFile
ZipFile
in order to check the
entries for zip bombs
while reading the archive.
The alert limits can be globally defined via setMaxEntrySize(long)
and setMinInflateRatio(double)
.
Constructor and Description |
---|
ZipSecureFile(File file) |
ZipSecureFile(String name) |
Modifier and Type | Method and Description |
---|---|
ZipArchiveThresholdInputStream |
getInputStream(ZipArchiveEntry entry)
Returns an input stream for reading the contents of the specified
zip file entry.
|
static long |
getMaxEntrySize()
Returns the current maximum allowed uncompressed file size.
|
static long |
getMaxTextSize()
Returns the current maximum allowed text size.
|
static double |
getMinInflateRatio()
Returns the current minimum compression rate that is used.
|
String |
getName()
Returns the path name of the ZIP file.
|
static void |
setMaxEntrySize(long maxEntrySize)
Sets the maximum file size of a single zip entry.
|
static void |
setMaxTextSize(long maxTextSize)
Sets the maximum number of characters of text that are
extracted before an exception is thrown during extracting
text from documents.
|
static void |
setMinInflateRatio(double ratio)
Sets the ratio between de- and inflated bytes to detect zipbomb.
|
close, closeQuietly, getEncoding, getEntries, getEntry
public ZipSecureFile(File file) throws IOException
IOException
public ZipSecureFile(String name) throws IOException
IOException
public static void setMinInflateRatio(double ratio)
ratio
- the ratio between de- and inflated bytes to detect zipbombpublic static double getMinInflateRatio()
public static void setMaxEntrySize(long maxEntrySize)
maxEntrySize
- the max. file size of a single zip entrypublic static long getMaxEntrySize()
public static void setMaxTextSize(long maxTextSize)
maxTextSize
- the max. file size of a single zip entrypublic static long getMaxTextSize()
public ZipArchiveThresholdInputStream getInputStream(ZipArchiveEntry entry) throws IOException
Closing this ZIP file will, in turn, close all input streams that have been returned by invocations of this method.
getInputStream
in class ZipFile
entry
- the zip file entryIOException
- if an I/O error has occurredIllegalStateException
- if the zip file has been closedpublic String getName()
Copyright © 2010 - 2020 Adobe. All Rights Reserved