A drop-in replacement for the classes in the package
{@link java.util.zip} for reading and writing ZIP files.
The classes in this package read and write ZIP files according to
a subset of PKWARE's
ZIP File Format Specification
,
Version 6.3.2 from September 28, 2007.
The subset has been selected in order to achieve the following
objectives:
-
Full interoperability with ZIP files read or written by the
package {@link java.util.zip} of Sun's Java SE 7
implementation.
-
Support for
{@link de.schlichtherle.truezip.zip.ZipOutputStream#ZipOutputStream(java.io.OutputStream,de.schlichtherle.truezip.zip.ZipFile) appending}
to an existing ZIP file.
-
Support for
{@link de.schlichtherle.truezip.zip.ZipFile#recoverLostEntries() recovering}
lost entries when reading a ZIP File.
-
Support for
{@link de.schlichtherle.truezip.zip.ZipEntry#isEncrypted() reading}
and
{@link de.schlichtherle.truezip.zip.ZipEntry#setEncrypted(boolean) writing}
encrypted or authenticated ZIP entries.
Currently, only the
WinZip AES Specification
is supported.
You need to implement the interface
{@link de.schlichtherle.truezip.zip.WinZipAesParameters}
and inject it for reading
and writing to the
{@link de.schlichtherle.truezip.zip.ZipFile#setCryptoParameters(de.schlichtherle.truezip.zip.ZipCryptoParameters) ZipFile.setCryptoParameters(ZipCryptoParameters)}
and
{@link de.schlichtherle.truezip.zip.ZipOutputStream#setCryptoParameters(de.schlichtherle.truezip.zip.ZipCryptoParameters) ZipOutputStream.setCryptoParameters(ZipCryptoParameters)}
classes.
-
Support for
{@link de.schlichtherle.truezip.zip.ZipEntry#getMethod() reading}
and
{@link de.schlichtherle.truezip.zip.ZipEntry#setMethod(int) writing}
BZIP2 compressed ZIP entries.
-
Support for selectable character sets, in particular
IBM Code Page 437 (alias IBM PC) for PKZIP compatibility
and UTF-8 for Java Archive (JAR) compatibility.
Note that using any other character set except CP437 or UTF-8
is strongly discouraged because it will result in
interoperability issues with third party tools, especially
when sharing archive files between different locales!
-
Support for
{@link de.schlichtherle.truezip.zip.ZipEntry#getExternalAttributes() reading}
and
{@link de.schlichtherle.truezip.zip.ZipEntry#setExternalAttributes(long) writing}
external file attributes.
-
Support for reading and writing ZIP64 extensions with the
following restrictions:
-
The maximum file size is {@link java.lang.Long#MAX_VALUE}.
-
The maximum number of entries in the Central Directory
is {@link java.lang.Integer#MAX_VALUE}.
-
The offsets in ZIP64 files must respect a preamble if
present, i.e. they must by exact.
This is in contrast to ZIP32 files where the offsets
do not need to respect a preamble if present.
Preambles are primarily used to contain self extracting
(SFX) executable code.
-
{@link de.schlichtherle.truezip.zip.ZipFile} supports
reading archive data from the random access read only
interface {@link de.schlichtherle.truezip.rof.ReadOnlyFile},
which allows to read archive data from composite data sources
like e.g. RAES encrypted ZIP files directly without the need
to decrypt them to a temporary file first.