About TrueZIP Driver ZIP
This module contains the file system driver service class de.schlichtherle.truezip.fs.archive.zip.ZipDriverService which provides the following map of file system drivers:
URI Schemes / Archive File Suffixes | File System Driver Class |
---|---|
ear, jar, war | de.schlichtherle.truezip.fs.archive.zip.JarDriver |
exe | de.schlichtherle.truezip.fs.archive.zip.ReadOnlySfxDriver |
odt, ott, odg, otg, odp, otp, ods, ots, odc, otc, odi, oti, odf, otf, odm, oth, odb | de.schlichtherle.truezip.fs.archive.zip.OdfDriver |
zip | de.schlichtherle.truezip.fs.archive.zip.ZipDriver |
Add the JAR artifact of this module to the run time class path to make its file system drivers available for service location in the client API modules. The URI schemes will then get recognized as default archive file suffixes by the class de.schlichtherle.truezip.file.TArchiveDetector.
Key Features
- Appending To Existing ZIP Files
- New ZIP entries can get appended to existing ZIP files using a client API with a file system driver or the ZIP classes directly.
To use this feature with a client API, set FsOutputOption.GROW, e.g. in TConfig.setOutputPreferences(BitField).
To use this feature with the ZIP API, call ZipOutputStream(OutputStream, ZipFile).
- Recovery Of Lost ZIP Entries
- When reading truncated ZIP files, lost entries can get recovered.
To use this feature with a client API, you don't need to do anything. This happens automatically if you use any of the file system drivers for reading ZIP files.
To use this feature with the ZIP API, call ZipFile.recoverLostEntries().
- WinZip AES Specification
- When reading or writing a ZIP file, ZIP entry data can get encrypted and authenticated according to the WinZip AES specification.
To use this feature with a client API, set FsOutputOption.ENCRYPT, e.g. in TConfig.setOutputPreferences(BitField), or install a custom file system driver which sets this option before calling its super-class implementation in ZipDriver.newEntry(String, Entry.Type, Entry, BitField). In either case, if you don't want to use the built-in KeyManagerZipCryptoParameters for prompting the user for a password using a Swing GUI or the console, then you should override ZipDriver.zipCryptoParameters(FsModel, Charset) in order to provide custom WinZipAesParameters, too.
To use this feature with the ZIP API, call ZipEntry.setEncrypted(boolean) first. Then call ZipFile.setCryptoParameters(ZipCryptoParameters) or ZipOutputStream.setCryptoParameters(ZipCryptoParameters) respectively.
Note that the WinZip AES encryption scheme does not encrypt and not authenticate the ZIP entry meta data, e.g. the comments or ZIP entry names. If you want this, then please use the ZIP.RAES file format instead.
- BZIP2 Compression
- When reading or writing a ZIP file, ZIP entry data can get decompressed or compressed using the BZIP2 algorithm. To use this feature when reading a BZIP compressed ZIP entry, you don't need to do anything - decompression happens automatically.
To use this feature for writing a BZIP2 compressed ZIP entry with a client API, install a custom file system driver which overrides ZipDriver.getMethod().
To use this feature for writing a BZIP2 compressed ZIP entry with the ZIP API, call ZipEntry.setMethod(int)
- Selectable Character Sets
- The character set for reading and writing ZIP comments and ZIP entry names can get set when using a file system driver or the ZIP classes directly.
To use this feature with a client API, install a custom file system driver which overrides ZipDriver.getCharset().
To use this feature with the ZIP API, call ZipOutputStream(OutputStream, Charset) or ZipFile(File, Charset).
- External File Attributes
- External file attributes can get used to set executable bits for third party tools, etc. This requires direct use of the ZIP classes. See ZipEntry.setExternalAttributes(long).
- ZIP64 Extensions
- ZIP64 extensions are automatically and transparently activated when reading or writing ZIP files of more than 4 GB size.