Class ZipArchiveOutputStream

All Implemented Interfaces:
Closeable, Flushable, AutoCloseable
Direct Known Subclasses:
JarArchiveOutputStream

Reimplementation of java.util.zip.ZipOutputStream to handle the extended functionality of this package, especially internal/external file attributes and extra fields with different layouts for local file data and central directory entries.

This class will try to use SeekableByteChannel when it knows that the output is going to go to a file and no split archive shall be created.

If SeekableByteChannel cannot be used, this implementation will use a Data Descriptor to store size and CRC information for DEFLATED entries, you don't need to calculate them yourself. Unfortunately, this is not possible for the STORED method, where setting the CRC and uncompressed size information is required before putArchiveEntry(ZipArchiveEntry) can be called.

As of Apache Commons Compress 1.3, the class transparently supports Zip64 extensions and thus individual entries and archives larger than 4 GB or with more than 65,536 entries in most cases but explicit control is provided via setUseZip64(org.apache.commons.compress.archivers.zip.Zip64Mode). If the stream can not use SeekableByteChannel and you try to write a ZipArchiveEntry of unknown size, then Zip64 extensions will be disabled by default.

This class is not thread-safe