Java Compression Library for Handling ZIP Archives
Open Source Java API enables programmers to compress a file or directory into a ZIP archive, comparing two ZIP archives entries & so on.
zt-zip (ZeroTurnaround ZIP Library) is a simple archiving and compression library for Java that enables software developers to operate with Java archives inside their own apps. The library supports packing and unpacking directories recursively and easily iterate through ZIP entries. The library is very simple and produces efficient results when only single entries are extracted from ZIP files.
The library has included support for both basic and some advanced features, such as Compress a directory into a ZIP archive, compress a file into a ZIP archive, add an entry from file or byte array to a ZIP archive, replace a ZIP archive entry from file or from a byte array, Add or replace entries in a ZIP archive, Extract a ZIP archive, Check if an entry exists in a ZIP archive, extract an entry from a ZIP archive into a byte array, extract a ZIP archive which becomes a directory and many more.
The library is very safe to use and makes sure that no streams are left open by accident. The library also supports comparing two ZIP archives entries with different names as well as with the same name. You can also easily transform a ZIP archive entry into uppercase.
At A Glance
An overview of zt-zip features.
- Create ZIP Archive
- Extract ZIP file
- Check entry
- Extract file
- Compress directory
- Add entry byte array
- Add entry from file
- Replace file in archive
- Delete archive file
- Transform ZIP archive
- Compare ZIP archive
zt-zip only requires Java 1.5 & above
Getting Started with zt-zip
To run your project using zt-zip, firs of all you need to Java 1.5 & above. Use the following command to install it.
Install via Git command
git clone https://github.com/zeroturnaround/zt-zip.git
Jarchivelib Maven Dependency
<dependency> <groupId>org.zeroturnaround</groupId> <artifactId>zt-zip</artifactId> <version>1.14</version>
Compress a File into a ZIP Archive via Java
The open source zt-zip library has provided functionality for compressing a file into a ZIP archive using Java commands. The library also provides support for adding a directory into the ZIP archive with ease. The library supports adding an entry from a file to as well as from a byte array to a ZIP archive. It is also possible to replace an entry in the ZIP archive. You can also compress a directory into a ZIP archive with a parent directory.
Compare Two ZIP Archives via Java API
The zt-zip library gives software programmers the power to compare two ZIP archives ignoring timestamps of the entries inside their own Java apps. You just need to provide the complete address of the two files. Using the library developers can easily compare two ZIP archive entries with different names as well as with the same names.
Extracting ZIP Archives via Java
The free zt-zip library allows to programmatically extract files from ZIP archives inside their own apps using a couple of lines of Java code. It has included several important features related unpacking files, such as extract an entry from a ZIP archive into a file or byte array, check if an entry exists or not, extract a ZIP archive which becomes a directory, extract files using name matching pattern and many more.