https://github.com/cilki/zipset
A small library for building zip files lazily
https://github.com/cilki/zipset
java zip zip-set zip-util
Last synced: 9 months ago
JSON representation
A small library for building zip files lazily
- Host: GitHub
- URL: https://github.com/cilki/zipset
- Owner: cilki
- License: apache-2.0
- Created: 2019-03-08T17:26:17.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2021-05-17T11:13:52.000Z (about 5 years ago)
- Last Synced: 2025-07-11T14:18:32.613Z (12 months ago)
- Topics: java, zip, zip-set, zip-util
- Language: Java
- Homepage:
- Size: 107 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://search.maven.org/search?q=com.github.cilki)
[](https://travis-ci.org/cilki/ZipSet)
[](https://codecov.io/gh/cilki/ZipSet)
**ZipSet** is a small zero-dependency Java library for building zip files lazily. It lets you think of a zip file like a `Set` that can be manipulated with standard set operations. ZipSet doesn't do any I/O until `build` is invoked, so all modifications are applied in a single step without the need for a temporary directory. Even the beautiful `jdk.zipfs` module requires changes to nested zip files be made via a temporary file.
#### Primary Usage
```
// Create a new ZipSet from an existing zip file
ZipSet zip = new ZipSet(sourceZipFile);
// Lazily add some entries
zip.add("test.txt", "1234".getBytes()); // A byte array
zip.add("test.png", Paths.get("test.png")); // A file on the filesystem
zip.add("inner.zip", anotherZipSet); // Another ZipSet()
// Lazily add an entry to a nested zip
zip.add("inner.zip!/123.txt", Paths.get("123.txt"))
// Exclude some entries
zip.sub("delete.txt")
zip.sub("inner.zip!/example.txt");
// Output a new zip file containing all modifications in a single sweep
zip.build(outputZipFile);
```