public class ZipInputStreamZipEntrySource extends java.lang.Object implements ZipEntrySource
close()
as soon as you're
done, to free up that memory!Constructor and Description |
---|
ZipInputStreamZipEntrySource(ZipArchiveThresholdInputStream inp)
Reads all the entries from the ZipInputStream
into memory, and don't close (since POI 4.0.1) the source stream.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Indicates we are done with reading, and
resources may be freed
|
java.util.Enumeration<? extends org.apache.commons.compress.archivers.zip.ZipArchiveEntry> |
getEntries()
Returns an Enumeration of all the Entries
|
org.apache.commons.compress.archivers.zip.ZipArchiveEntry |
getEntry(java.lang.String path)
Return an entry by its path
|
java.io.InputStream |
getInputStream(org.apache.commons.compress.archivers.zip.ZipArchiveEntry zipEntry)
Returns an InputStream of the decompressed
data that makes up the entry
|
static int |
getThresholdBytesForTempFiles()
Get the threshold at which it a zip entry is regarded as too large for holding in memory
and the data is put in a temp file instead (defaults to -1 meaning temp files are not used)
|
boolean |
isClosed()
Has close been called already?
|
static void |
setEncryptTempFiles(boolean encrypt)
Encrypt temp files when they are used.
|
static void |
setThresholdBytesForTempFiles(int thresholdBytes)
Set the threshold at which a zip entry is regarded as too large for holding in memory
and the data is put in a temp file instead
|
static boolean |
shouldEncryptTempFiles()
Whether temp files should be encrypted (default false).
|
public ZipInputStreamZipEntrySource(ZipArchiveThresholdInputStream inp) throws java.io.IOException
java.io.IOException
setThresholdBytesForTempFiles(int)
public static void setThresholdBytesForTempFiles(int thresholdBytes)
thresholdBytes
- number of bytes at which a zip entry is regarded as too large for holding in memory
and the data is put in a temp file instead - defaults to -1 meaning temp files are not used
and that zip entries with more than 2GB of data after decompressing will fail, 0 means all
zip entries are stored in temp files. A threshold like 50000000 (approx 50Mb is recommended)setEncryptTempFiles(boolean)
public static int getThresholdBytesForTempFiles()
public static void setEncryptTempFiles(boolean encrypt)
encrypt
- whether temp files should be encryptedsetThresholdBytesForTempFiles(int)
public static boolean shouldEncryptTempFiles()
public java.util.Enumeration<? extends org.apache.commons.compress.archivers.zip.ZipArchiveEntry> getEntries()
ZipEntrySource
getEntries
in interface ZipEntrySource
public java.io.InputStream getInputStream(org.apache.commons.compress.archivers.zip.ZipArchiveEntry zipEntry) throws java.io.IOException
ZipEntrySource
getInputStream
in interface ZipEntrySource
java.io.IOException
public void close() throws java.io.IOException
ZipEntrySource
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in interface ZipEntrySource
java.io.IOException
public boolean isClosed()
ZipEntrySource
isClosed
in interface ZipEntrySource
public org.apache.commons.compress.archivers.zip.ZipArchiveEntry getEntry(java.lang.String path)
ZipEntrySource
getEntry
in interface ZipEntrySource
path
- the path in unix-notationnull
if not foundCopyright 2022 The Apache Software Foundation or its licensors, as applicable.