{"id":26327306,"url":"https://github.com/oleg-cherednik/zip4jvm","last_synced_at":"2025-03-15T20:18:25.016Z","repository":{"id":42469081,"uuid":"173146926","full_name":"oleg-cherednik/zip4jvm","owner":"oleg-cherednik","description":"zip files support for JDK application: split, zip64, encryption, streaming","archived":false,"fork":false,"pushed_at":"2025-02-26T05:56:53.000Z","size":166842,"stargazers_count":27,"open_issues_count":21,"forks_count":3,"subscribers_count":3,"default_branch":"develop","last_synced_at":"2025-02-26T06:29:12.855Z","etag":null,"topics":["aes","bzip2","deflate","deflate64","java","lzma","pkware","zip","zip64","zstandard","zstd"],"latest_commit_sha":null,"homepage":"https://github.com/oleg-cherednik/zip4jvm","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/oleg-cherednik.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"oleg-cherednik"}},"created_at":"2019-02-28T16:28:20.000Z","updated_at":"2025-02-22T11:52:24.000Z","dependencies_parsed_at":"2025-02-26T06:35:38.430Z","dependency_job_id":null,"html_url":"https://github.com/oleg-cherednik/zip4jvm","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oleg-cherednik%2Fzip4jvm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oleg-cherednik%2Fzip4jvm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oleg-cherednik%2Fzip4jvm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oleg-cherednik%2Fzip4jvm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oleg-cherednik","download_url":"https://codeload.github.com/oleg-cherednik/zip4jvm/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243785074,"owners_count":20347409,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aes","bzip2","deflate","deflate64","java","lzma","pkware","zip","zip64","zstandard","zstd"],"created_at":"2025-03-15T20:18:24.575Z","updated_at":"2025-03-15T20:18:24.998Z","avatar_url":"https://github.com/oleg-cherednik.png","language":"Java","funding_links":["https://github.com/sponsors/oleg-cherednik"],"categories":[],"sub_categories":[],"readme":"[![Maven Central](https://maven-badges.herokuapp.com/maven-central/ru.oleg-cherednik.zip4jvm/zip4jvm/badge.svg)](https://maven-badges.herokuapp.com/maven-central/ru.oleg-cherednik.zip4jvm/zip4jvm)\n[![javadoc](https://javadoc.io/badge2/ru.oleg-cherednik.zip4jvm/zip4jvm/javadoc.svg)](https://javadoc.io/doc/ru.oleg-cherednik.zip4jvm/zip4jvm)\n[![java1.8](https://badgen.net/badge/java/1.8/blue)](https://badgen.net/)\n[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](http://www.apache.org/licenses/LICENSE-2.0.txt)\n\n[![github-ci](https://github.com/oleg-cherednik/zip4jvm/actions/workflows/github-ci.yml/badge.svg?branch=master\u0026event=push)](https://github.com/oleg-cherednik/zip4jvm/actions)\n[![license-scan](https://app.fossa.com/api/projects/git%2Bgithub.com%2Foleg-cherednik%2Fjson-api.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Foleg-cherednik%2Fjson-api?ref=badge_shield)\n[![quality](https://app.codacy.com/project/badge/Grade/7b6b963fef254ff4b00b8be0304e829b?branch=master)](https://app.codacy.com/gh/oleg-cherednik/zip4jvm/dashboard?branch=master)\n[![coverage](https://app.codacy.com/project/badge/Coverage/7b6b963fef254ff4b00b8be0304e829b?branch=master)](https://app.codacy.com/gh/oleg-cherednik/zip4jvm/coverage/dashboard?branch=master)\n\n\u003cdetails\u003e\u003csummary\u003edevelop\u003c/summary\u003e\n\u003cp\u003e\n\n[![github-ci](https://github.com/oleg-cherednik/zip4jvm/actions/workflows/github-ci.yml/badge.svg?branch=develop\u0026event=push)](https://github.com/oleg-cherednik/zip4jvm/actions)\n[![quality](https://app.codacy.com/project/badge/Grade/7b6b963fef254ff4b00b8be0304e829b?branch=develop)](https://app.codacy.com/gh/oleg-cherednik/zip4jvm/dashboard?branch=develop)\n[![coverage](https://app.codacy.com/project/badge/Coverage/7b6b963fef254ff4b00b8be0304e829b?branch=develop)](https://app.codacy.com/gh/oleg-cherednik/zip4jvm/coverage/dashboard?branch=develop)\n\n\u003c/p\u003e\n\u003c/details\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://github.com/oleg-cherednik/zip4jvm/blob/master/img/zip4jvm_qr.png?raw=true\"\u003e\n        \u003cimg alt=\"QR-code\" src=\"img/zip4jvm_qr_small.png\" /\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\nzip4jvm - a java library for working with zip files\n=====================\n\n## Features\n\n* Add regular files or directories to new or existed zip archive;\n* Extract regular files or directories from zip archive;\n* Encryption algorithms support:\n  * [PKWare](https://en.wikipedia.org/wiki/PKWare)\n  * [AES](https://en.wikipedia.org/wiki/Advanced_Encryption_Standard)\n* Compression support:\n  * STORE\n  * [DEFLATE (default)](https://en.wikipedia.org/wiki/DEFLATE)\n  * [ENHANCED DEFLATE](http://deflate64.com) (read-only)\n  * [BZIP2](https://en.wikipedia.org/wiki/Bzip2)\n  * [LZMA](https://en.wikipedia.org/wiki/Lempel%E2%80%93Ziv%E2%80%93Markov_chain_algorithm)\n  * [ZSTD](https://en.wikipedia.org/wiki/Zstandard)\n* Individual settings for each zip entry (i.e. some of files can be encrypted, and some - not);\n* Streaming support for adding and extracting;\n* Read/Write password protected Zip files and streams;\n* [ZIP64](https://en.wikipedia.org/wiki/Zip_(file_format)#ZIP64) format support;\n* Multi-volume zip archive support:\n  * [PKWare](https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT), i.e. `filename.zip`, `filename.z01`, `filename.z02`\n  * [7-Zip](https://en.wikipedia.org/wiki/7-Zip#Features), i.e. `filename.zip.001`, `filename.zip.002`, `filename.zip.003` (read-only)\n* Unicode for comments and file names.\n\n## Gradle\n\n```\ncompile 'ru.oleg-cherednik.zip4jvm:zip4jvm:1.11'\n```\n\n## Maven\n\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003eru.oleg-cherednik.zip4jvm\u003c/groupId\u003e\n    \u003cartifactId\u003ezip4jvm\u003c/artifactId\u003e\n    \u003cversion\u003e1.11\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n## Usage\n\nTo simplify usage of _zip4jvm_, there're following classes:\n* [ZipIt](#zipit) - add files to archive;\n* [UnzipIt](#unzipit) - extract files from archive;\n* [ZipMisc](#zipmisc) - other zip file activities;\n* [ZipInfo](#zipinfo) - zip file information and diagnostics.\n\n### ZipIt\n\n#### Regular files and directories can be represented as `Path`\n\n##### Create (or open existed) zip archive and add regular file */cars/bentley-continental.jpg*\n\n```java\nPath zip = Paths.get(\"filename.zip\");\nPath file = Path.get(\"/cars/bentley-continental.jpg\")\nZipIt.zip(zip).add(file);\n```\n\u003e```\n\u003e/-\n\u003e |-- cars\n\u003e |    |-- bentley-continental.jpg\n\u003e |    |-- ferrari-458-italia.jpg\n\u003e |    |-- wiesmann-gt-mf5.jpg\n\u003e |-- bikes\n\u003e |    |-- ducati-panigale-1199.jpg\n\u003e |    |-- kawasaki-ninja-300.jpg\n\u003e |    |-- honda-cbr600rr.jpg\n\u003e |-- saint-petersburg.jpg\n\u003e```\n\u003e```\n\u003efilename.zip\n\u003e |-- bentley-continental.jpg\n\u003e```\n\n**Note:** regular file is added to the root of the zip archive.\n\n##### Create (or open existed) zip archive and add directory */cars*\n\n```java\nPath zip = Paths.get(\"filename.zip\");\nPath dir = Path.get(\"/cars\");\nZipIt.zip(zip).add(dir);\n```\n\u003e```\n\u003e/-\n\u003e |-- cars\n\u003e |    |-- bentley-continental.jpg\n\u003e |    |-- ferrari-458-italia.jpg\n\u003e |    |-- wiesmann-gt-mf5.jpg\n\u003e |-- bikes\n\u003e |    |-- ducati-panigale-1199.jpg\n\u003e |    |-- kawasaki-ninja-300.jpg\n\u003e |    |-- honda-cbr600rr.jpg\n\u003e |-- saint-petersburg.jpg\n\u003e```\n\u003e```\n\u003efilename.zip\n\u003e |-- cars\n\u003e      |-- bentley-continental.jpg\n\u003e      |-- ferrari-458-italia.jpg\n\u003e      |-- wiesmann-gt-mf5.jpg\n\u003e```\n\n**Note:** directory is added to the root of the zip archive keeping the initial structure.\n\n##### Create (or open existed) zip archive and add some regular files and/or directories\n\n```java\nPath zip = Paths.get(\"filename.zip\");\nCollection\u003cPath\u003e paths = Arrays.asList(\n        Paths.get(\"/bikes/ducati-panigale-1199.jpg\"),\n        Paths.get(\"/bikes/honda-cbr600rr.jpg\"),\n        Paths.get(\"/cars\"),\n        Paths.get(\"/saint-petersburg.jpg\"));\nZipIt.zip(zip).add(paths);\n```\n\u003e```\n\u003e/-\n\u003e |-- cars\n\u003e |    |-- bentley-continental.jpg\n\u003e |    |-- ferrari-458-italia.jpg\n\u003e |    |-- wiesmann-gt-mf5.jpg\n\u003e |-- bikes\n\u003e |    |-- ducati-panigale-1199.jpg\n\u003e |    |-- kawasaki-ninja-300.jpg\n\u003e |    |-- honda-cbr600rr.jpg\n\u003e |-- saint-petersburg.jpg\n\u003e```\n\u003e```\n\u003efilename.zip\n\u003e |-- cars\n\u003e |    |-- bentley-continental.jpg\n\u003e |    |-- ferrari-458-italia.jpg\n\u003e |    |-- wiesmann-gt-mf5.jpg\n\u003e |-- ducati-panigale-1199.jpg\n\u003e |-- honda-cbr600rr.jpg\n\u003e |-- saint-petersburg.jpg\n\u003e```\n\n**Note:** each regular file from the list is added to the root of the zip archive.\n\n**Note:** each directory from the list is added to the root of the zip archive keeping the initial structure.\n\n#### Regular files and empty directories are available as `InputStream`\n\n##### Create (or open existed) zip archive and add input streams content as regular files\n\n```java\nPath zip = Zip4jvmSuite.subDirNameAsMethodName(rootDir).resolve(\"filename.zip\");\n\ntry (ZipFile.Writer zipFile = ZipIt.zip(zip).open()) {\n    zipFile.add(ZipFile.Entry.builder()\n                             .inputStreamSupplier(() -\u003e new FileInputStream(\"/cars/bentley-continental.jpg\"))\n                             .fileName(\"my_cars/bentley-continental.jpg\")\n                             .uncompressedSize(Files.size(Paths.get(\"/cars/bentley-continental.jpg\"))).build());\n\n    zipFile.add(ZipFile.Entry.builder()\n                             .inputStreamSupplier(() -\u003e new FileInputStream(\"/bikes/kawasaki-ninja-300.jpg\"))\n                             .fileName(\"my_bikes/kawasaki.jpg\")\n                             .uncompressedSize(Files.size(Paths.get(\"/bikes/kawasaki-ninja-300.jpg\"))).build());\n}\n```\n\u003e```\n\u003e/-\n\u003e |-- cars\n\u003e |    |-- bentley-continental.jpg\n\u003e |    |-- ferrari-458-italia.jpg\n\u003e |    |-- wiesmann-gt-mf5.jpg\n\u003e |-- bikes\n\u003e |    |-- ducati-panigale-1199.jpg\n\u003e |    |-- kawasaki-ninja-300.jpg\n\u003e |    |-- honda-cbr600rr.jpg\n\u003e |-- saint-petersburg.jpg\n\u003e```\n\u003e```\n\u003efilename.zip\n\u003e |-- my_cars\n\u003e |    |-- bentley-continental.jpg\n\u003e |-- my_bikes\n\u003e |    |-- kawasaki.jpg\n\u003e```\n\n**Note:** each entry is treated as separate input stream of the regular file.\n\n### UnzipIt\n\n### Regular files and directories to `Path` destination\n\n##### Extract all entries into given directory\n\n```java\nPath zip = Paths.get(\"filename.zip\");\nPath destDir = Paths.get(\"/filename_content\");\nUnzipIt.zip(zip).destDir(destDir).extract();\n```\n\u003e```\n\u003efilename.zip\n\u003e |-- cars\n\u003e |    |-- bentley-continental.jpg\n\u003e |    |-- ferrari-458-italia.jpg\n\u003e |    |-- wiesmann-gt-mf5.jpg\n\u003e |-- bikes\n\u003e |    |-- ducati-panigale-1199.jpg\n\u003e |    |-- kawasaki-ninja-300.jpg\n\u003e |-- saint-petersburg.jpg\n\u003e```\n\u003e```\n\u003e/filename_content\n\u003e  |-- cars\n\u003e  |-- cars\n\u003e  |    |-- bentley-continental.jpg\n\u003e  |    |-- ferrari-458-italia.jpg\n\u003e  |    |-- wiesmann-gt-mf5.jpg\n\u003e  |-- bikes\n\u003e  |    |-- ducati-panigale-1199.jpg\n\u003e  |    |-- kawasaki-ninja-300.jpg\n\u003e  |-- saint-petersburg.jpg\n\u003e```\n\n**Note:** all entries (i.e. regular files and empty directories) are added to the destination\n directory keeping the initial structure.\n\n##### Extract regular file's entry into given directory\n\n```java\nPath zip = Paths.get(\"filename.zip\");\nPath destDir = Paths.get(\"/filename_content\");\nUnzipIt.zip(zip).destDir(destDir).extract(\"/cars/bentley-continental.jpg\");\n```\n\u003e```\n\u003efilename.zip\n\u003e |-- cars\n\u003e |    |-- bentley-continental.jpg\n\u003e |    |-- ferrari-458-italia.jpg\n\u003e |    |-- wiesmann-gt-mf5.jpg\n\u003e |-- bikes\n\u003e |    |-- ducati-panigale-1199.jpg\n\u003e |    |-- kawasaki-ninja-300.jpg\n\u003e |-- saint-petersburg.jpg\n\u003e```\n\u003e```\n\u003e/filename_content\n\u003e  |-- bentley-continental.jpg\n\u003e```\n\n**Note:** regular file's entry is added to the root of the destination directory.\n\n##### Extract directory entries into given directory\n```java\nPath zip = Paths.get(\"filename.zip\");\nPath destDir = Paths.get(\"/filename_content\");\nUnzipIt.zip(zip).destDir(destDir).extract(\"cars\");\n```\n\u003e```\n\u003efilename.zip\n\u003e |-- cars\n\u003e |    |-- bentley-continental.jpg\n\u003e |    |-- ferrari-458-italia.jpg\n\u003e |    |-- wiesmann-gt-mf5.jpg\n\u003e |-- bikes\n\u003e |    |-- ducati-panigale-1199.jpg\n\u003e |    |-- kawasaki-ninja-300.jpg\n\u003e |-- saint-petersburg.jpg\n\u003e```\n\u003e```\n\u003e/filename_content\n\u003e  |-- cars\n\u003e  |    |-- bentley-continental.jpg\n\u003e  |    |-- ferrari-458-italia.jpg\n\u003e  |    |-- wiesmann-gt-mf5.jpg\n\u003e```\n\n**Note:** extract all entries belong to the given directory; content of these entries is added to\nthe destination directory keeping the initial structure.\n\n##### Extract some entries into given directory\n\n```java\nPath zip = Paths.get(\"filename.zip\");\nPath destDir = Paths.get(\"/filename_content\");\nCollection\u003cPath\u003e fileNames = Arrays.asList(\"cars\", \"bikes/ducati-panigale-1199.jpg\", \"saint-petersburg.jpg\");\nUnzipIt.zip(zip).destDir(destDir).extract(fileNames);\n```\n\u003e```\n\u003efilename.zip\n\u003e |-- cars\n\u003e |    |-- bentley-continental.jpg\n\u003e |    |-- ferrari-458-italia.jpg\n\u003e |    |-- wiesmann-gt-mf5.jpg\n\u003e |-- bikes\n\u003e |    |-- ducati-panigale-1199.jpg\n\u003e |    |-- kawasaki-ninja-300.jpg\n\u003e |-- saint-petersburg.jpg\n\u003e```\n\u003e```\n\u003e/filename_content\n\u003e  |-- cars\n\u003e  |    |-- bentley-continental.jpg\n\u003e  |    |-- ferrari-458-italia.jpg\n\u003e  |    |-- wiesmann-gt-mf5.jpg\n\u003e  |-- ducati-panigale-1199.jpg\n\u003e  |-- saint-petersburg.jpg\n\u003e```\n\n**Note:** directory is extracting keeping the initial structure; regular file is extracted into root of\ndestination directory\n\n### Regular files as `InputStream` source\n\n##### Get input stream for regular file's entry\n\n```java\nPath zip = Paths.get(\"filename.zip\");\nPath destFile = Paths.get(\"/filename_content/bentley.jpg\");\ntry (InputStream in = UnzipIt.zip(zip).stream(\"/cars/bentley-continental.jpg\");\n     OutputStream out = new FileOutputStream(destFile.toFile())) {\n    IOUtils.copyLarge(in, out);\n}\n```\n\u003e```\n\u003efilename.zip\n\u003e |-- cars\n\u003e |    |-- bentley-continental.jpg\n\u003e |    |-- ferrari-458-italia.jpg\n\u003e |    |-- wiesmann-gt-mf5.jpg\n\u003e |-- bikes\n\u003e |    |-- ducati-panigale-1199.jpg\n\u003e |    |-- kawasaki-ninja-300.jpg\n\u003e |-- saint-petersburg.jpg\n\u003e```\n\u003e```\n\u003e/filename_content\n\u003e  |-- bentley-continental.jpg\n\u003e```\n\n**Note:** Input stream for regular file's entry should be correctly closed to flush all data\n\n### Use password to unzip\n\nFor all unzip operation _password provider_ could be optionally set. It could be either single password or\npassword provider with _fileName_ of the entry as a key.\n\n#### Unzip with single password for entries\n\n```java\nchar[] password = \"1\".toCharArray();\nPath destDir = Paths.get(\"/filename_content\");\nList\u003cString\u003e fileNames = Arrays.asList(\"cars\", \"bikes/ducati-panigale-1199.jpg\", \"saint-petersburg.jpg\");\nUnzipIt.zip(zip).destDir(destDir).password(password).extract(fileNames);\n```\n\u003e```\n\u003efilename.zip  --\u003e password: 1\n\u003e |-- cars\n\u003e |    |-- bentley-continental.jpg\n\u003e |    |-- ferrari-458-italia.jpg\n\u003e |    |-- wiesmann-gt-mf5.jpg\n\u003e |-- bikes\n\u003e |    |-- ducati-panigale-1199.jpg\n\u003e |    |-- kawasaki-ninja-300.jpg\n\u003e |-- saint-petersburg.jpg\n\u003e```\n\u003e```\n\u003e/filename_content\n\u003e  |-- cars\n\u003e  |    |-- bentley-continental.jpg\n\u003e  |    |-- ferrari-458-italia.jpg\n\u003e  |    |-- wiesmann-gt-mf5.jpg\n\u003e  |-- ducati-panigale-1199.jpg\n\u003e  |-- saint-petersburg.jpg\n\u003e```\n\nOr separate password for each entry. The key is the _fileName_ of the entry:\n\n#### Unzip with separate password for each entry\n\n```java\nPath zip = Paths.get(\"filename.zip\");\nPath destFile = Paths.get(\"filename_content/bentley.jpg\");\n\nFunction\u003cString, char[]\u003e passwordProvider = fileName -\u003e {\n    if (fileName.startsWith(\"cars/\"))\n        return \"1\".toCharArray();\n    if (fileName.startsWith(\"bikes/ducati-panigale-1199.jpg\"))\n        return \"2\".toCharArray();\n    if (fileName.startsWith(\"saint-petersburg.jpg\"))\n            return \"3\".toCharArray();\n    return null;\n};\n\nUnzipSettings settings = UnzipSettings.builder().password(passwordProvider).build();\nList\u003cPath\u003e fileNames = Arrays.asList(\"cars\", \"bikes/ducati-panigale-1199.jpg\", \"saint-petersburg.jpg\");\nUnzipIt.zip(zip).destDir(destDir).settings(settings).extract(fileNames);\n```\n\u003e```\n\u003efilename.zip\n\u003e  |-- cars\n\u003e  |    |-- bentley-continental.jpg   --\u003e password: 1\n\u003e  |    |-- ferrari-458-italia.jpg    --\u003e password: 1\n\u003e  |    |-- wiesmann-gt-mf5.jpg       --\u003e password: 1\n\u003e  |-- bikes\n\u003e  |    |-- ducati-panigale-1199.jpg  --\u003e password: 2\n\u003e  |    |-- kawasaki-ninja-300.jpg\n\u003e  |-- saint-petersburg.jpg           --\u003e password: 3\n\u003e```\n\u003e```\n\u003e/filename_content\n\u003e  |-- cars\n\u003e  |    |-- bentley-continental.jpg\n\u003e  |    |-- ferrari-458-italia.jpg\n\u003e  |    |-- wiesmann-gt-mf5.jpg\n\u003e  |-- ducati-panigale-1199.jpg\n\u003e  |-- saint-petersburg.jpg\n\u003e```\n\n### ZipMisc\n\n#### Modify zip archive comment\n\n```java\nPath zip = Paths.get(\"filename.zip\");\nZipMisc zipFile = ZipMisc.zip(zip);\n\nzipFile.getComment();           // get current comment (null if it's not set)\nzipFile.setComment(\"comment\");  // set comment to 'comment'\nzipFile.setComment(null);       // remove comment\n```\n\n#### Get all entries\n\n```java\nPath zip = Paths.get(\"filename.zip\");\nZipMisc zipFile = ZipMisc.zip(zip);\nList\u003cZipFile.Entry\u003e entires = zipFile.getEntries().collect(Collectors.toList());\n\n/*\n * [entryNames]\n * cars/bentley-continental.jpg\n * cars/ferrari-458-italia.jpg\n * cars/wiesmann-gt-mf5.jpg\n * bikes/ducati-panigale-1199.jpg\n * bikes/kawasaki-ninja-300.jpg\n * saint-petersburg.jpg\n */\n```\n\u003e```\n\u003efilename.zip\n\u003e |-- cars\n\u003e |    |-- bentley-continental.jpg\n\u003e |    |-- ferrari-458-italia.jpg\n\u003e |    |-- wiesmann-gt-mf5.jpg\n\u003e |-- bikes\n\u003e |    |-- ducati-panigale-1199.jpg\n\u003e |    |-- kawasaki-ninja-300.jpg\n\u003e |-- saint-petersburg.jpg\n\u003e```\n\n**Note:** `zipFile.getEntries()` retrieves `Stream` with immutable `ZupFile.Entry` objects represent all entries in zip archive\n\n#### Remove entry by name\n\n```java\nPath zip = Paths.get(\"filename.zip\");\nZipMisc zipFile = ZipMisc.zip(zip);\nzipFile.removeEntryByName(\"cars/bentley-continental.jpg\");\n```\n\u003e```\n\u003efilename.zip (before)\n\u003e  |-- cars\n\u003e  |    |-- bentley-continental.jpg\n\u003e  |    |-- ferrari-458-italia.jpg\n\u003e  |    |-- wiesmann-gt-mf5.jpg\n\u003e  |-- bikes\n\u003e  |    |-- ducati-panigale-1199.jpg\n\u003e  |    |-- kawasaki-ninja-300.jpg\n\u003e  |-- saint-petersburg.jpg\n\u003e```\n\u003e```\n\u003efilename.zip (after)\n\u003e  |-- cars\n\u003e  |    |-- ferrari-458-italia.jpg\n\u003e  |    |-- wiesmann-gt-mf5.jpg\n\u003e  |-- bikes\n\u003e  |    |-- ducati-panigale-1199.jpg\n\u003e  |    |-- kawasaki-ninja-300.jpg\n\u003e  |-- saint-petersburg.jpg\n\u003e```\n\n**Note:** exactly one entry will be removed in case of entry with exact this name exists\n\n#### Remove some entries by name\n\n```java\nPath zip = Paths.get(\"filename.zip\");\nZipMisc zipFile = ZipMisc.zip(zip);\nCollection\u003cString\u003e entryNames = Arrays.asList(\"cars/ferrari-458-italia.jpg\", \"bikes/ducati-panigale-1199.jpg\");\nzipFile.removeEntryByName(entryNames);\n```\n\u003e```\n\u003efilename.zip (before)\n\u003e  |-- cars\n\u003e  |    |-- bentley-continental.jpg\n\u003e  |    |-- ferrari-458-italia.jpg\n\u003e  |    |-- wiesmann-gt-mf5.jpg\n\u003e  |-- bikes\n\u003e  |    |-- ducati-panigale-1199.jpg\n\u003e  |    |-- kawasaki-ninja-300.jpg\n\u003e  |-- saint-petersburg.jpg\n\u003e```\n\u003e```\n\u003efilename.zip (after)\n\u003e  |-- cars\n\u003e  |    |-- ferrari-458-italia.jpg\n\u003e  |    |-- wiesmann-gt-mf5.jpg\n\u003e  |-- bikes\n\u003e  |    |-- kawasaki-ninja-300.jpg\n\u003e  |-- saint-petersburg.jpg\n\u003e```\n\n#### Remove entry by name prefix\n\n```java\nPath zip = Paths.get(\"filename.zip\");\nZipMisc zipFile = ZipMisc.zip(zip);\nzipFile.removeEntryByNamePrefix(\"cars\")\n```\n\u003e```\n\u003efilename.zip (before)\n\u003e  |-- cars\n\u003e  |    |-- bentley-continental.jpg\n\u003e  |    |-- ferrari-458-italia.jpg\n\u003e  |    |-- wiesmann-gt-mf5.jpg\n\u003e  |-- bikes\n\u003e  |    |-- ducati-panigale-1199.jpg\n\u003e  |    |-- kawasaki-ninja-300.jpg\n\u003e  |-- saint-petersburg.jpg\n\u003e```\n\u003e```\n\u003efilename.zip (after)\n\u003e  |-- bikes\n\u003e  |    |-- ducati-panigale-1199.jpg\n\u003e  |    |-- kawasaki-ninja-300.jpg\n\u003e  |-- saint-petersburg.jpg\n\u003e```\n\n**Note:** multiple entries could be removed\n\n#### Check whether zip archive split or not\n\n```java\nPath zip = Paths.get(\"filename.zip\");\nZipMisc zipFile = ZipMisc.zip(zip);\nboolean split = zipFile.isSplit();\n```\n\n#### Merge split archive into solid one\n\n```java\nPath zipSrc = Paths.get(\"split.zip\");\nPath zip = Paths.get(\"filename.zip\");\nZipMisc zipFile = ZipMisc.zip(zipSrc);\nzipFile.merge(zip);\n```\n\n\u003e```\n\u003e/- (before)\n\u003e |-- split.z01\n\u003e |-- split.z02\n\u003e |-- split.z03\n\u003e |-- split.zip\n\u003e```\n\u003e```\n\u003e/- (after)\n\u003e |-- filename.zip\n\u003e```\n\n### ZipInfo\n\n#### Print content of zip file into console\n```java\nPath zip = Paths.get(\"filename.zip\");\nZipInfo.zip(zip).printShortInfo();\n```\n\u003e```\n\u003efilename.zip\n\u003e  |-- cars\n\u003e  |    |-- bentley-continental.jpg\n\u003e  |-- saint-petersburg.jpg\n\u003e```\n\u003e```\n\u003e --- console output ---\n\u003e(PK0506) End of Central directory record\n\u003e========================================\n\u003e    - location:                                     2365537 (0x00241861) bytes\n\u003e    - size:                                         22 bytes\n\u003e    part number of this part (0000):                1\n\u003e    part number of start of central dir (0000):     1\n\u003e    number of entries in central dir in this part:  3\n\u003e    total number of entries in central dir:         3\n\u003e    size of central dir:                            299 (0x0000012B) bytes\n\u003e    relative offset of central dir:                 2365238 (0x00241736) bytes\n\u003e    zipfile comment length:                         0 bytes\n\u003e\n\u003e(PK0102) Central directory\n\u003e==========================\n\u003e    - location:                                     2365238 (0x00241736) bytes\n\u003e    - size:                                         303 bytes\n\u003e    total entries:                                  3\n\u003e\n\u003e#1 (PK0102) [UTF-8] cars/\n\u003e-------------------------\n\u003e    - location:                                     2365238 (0x00241736) bytes\n\u003e    - size:                                         87 bytes\n\u003e    part number of this part (0000):                1\n\u003e    relative offset of local header:                0 (0x00000000) bytes\n\u003e    version made by operating system (00):          MS-DOS, OS/2, NT FAT\n\u003e    version made by zip software (31):              3.1\n\u003e    operat. system version needed to extract (00):  MS-DOS, OS/2, NT FAT\n\u003e    unzip software version needed to extract (10):  1.0\n\u003e    general purpose bit flag (0x0000) (bit 15..0):  0000.0000 0000.0000\n\u003e      file security status  (bit 0):                not encrypted\n\u003e      data descriptor       (bit 3):                no\n\u003e      strong encryption     (bit 6):                no\n\u003e      UTF-8 names          (bit 11):                no\n\u003e    compression method (00):                        none (stored)\n\u003e    file last modified on (0x5024 0x7EC0):          2020-01-04 15:54:00\n\u003e    32-bit CRC value:                               0x00000000\n\u003e    compressed size:                                0 bytes\n\u003e    uncompressed size:                              0 bytes\n\u003e    length of filename:                             5\n\u003e                                                    UTF-8\n\u003e    63 61 72 73 2F                                  cars/\n\u003e    length of file comment:                         0 bytes\n\u003e    internal file attributes:                       0x0000\n\u003e      apparent file type:                           binary\n\u003e    external file attributes:                       0x00000010\n\u003e      WINDOWS   (0x10):                             dir\n\u003e      POSIX (0x000000):                             none\n\u003e    extra field:                                    2365289 (0x00241769) bytes\n\u003e      - size:                                       36 bytes (1 record)\n\u003e    (0x000A) NTFS Timestamp:                        2365289 (0x00241769) bytes\n\u003e      - size:                                       36 bytes\n\u003e      - total tags:                                 1\n\u003e      (0x0001) Tag1:                                24 bytes\n\u003e        Creation Date:                              2020-01-04 12:50:54\n\u003e        Last Modified Date:                         2020-01-04 12:54:00\n\u003e        Last Accessed Date:                         2020-01-04 12:54:00\n\u003e\n\u003e#2 (PK0102) [UTF-8] cars/bentley-continental.jpg\n\u003e------------------------------------------------\n\u003e    - location:                                     2365325 (0x0024178D) bytes\n\u003e    - size:                                         110 bytes\n\u003e    part number of this part (0000):                1\n\u003e    relative offset of local header:                35 (0x00000023) bytes\n\u003e    version made by operating system (00):          MS-DOS, OS/2, NT FAT\n\u003e    version made by zip software (31):              3.1\n\u003e    operat. system version needed to extract (00):  MS-DOS, OS/2, NT FAT\n\u003e    unzip software version needed to extract (20):  2.0\n\u003e    general purpose bit flag (0x0000) (bit 15..0):  0000.0000 0000.0000\n\u003e      file security status  (bit 0):                not encrypted\n\u003e      data descriptor       (bit 3):                no\n\u003e      strong encryption     (bit 6):                no\n\u003e      UTF-8 names          (bit 11):                no\n\u003e    compression method (08):                        deflate\n\u003e      compression sub-type (deflation):             normal\n\u003e    file last modified on (0x4F24 0x3D6D):          2019-09-04 07:43:26\n\u003e    32-bit CRC value:                               0x71797968\n\u003e    compressed size:                                1380544 bytes\n\u003e    uncompressed size:                              1395362 bytes\n\u003e    length of filename:                             28\n\u003e                                                    UTF-8\n\u003e    63 61 72 73 2F 62 65 6E 74 6C 65 79 2D 63 6F 6E cars/bentley-con\n\u003e    74 69 6E 65 6E 74 61 6C 2E 6A 70 67             tinental.jpg\n\u003e    length of file comment:                         0 bytes\n\u003e    internal file attributes:                       0x0000\n\u003e      apparent file type:                           binary\n\u003e    external file attributes:                       0x00000020\n\u003e      WINDOWS   (0x20):                             arc\n\u003e      POSIX (0x000000):                             none\n\u003e    extra field:                                    2365399 (0x002417D7) bytes\n\u003e      - size:                                       36 bytes (1 record)\n\u003e    (0x000A) NTFS Timestamp:                        2365399 (0x002417D7) bytes\n\u003e      - size:                                       36 bytes\n\u003e      - total tags:                                 1\n\u003e      (0x0001) Tag1:                                24 bytes\n\u003e        Creation Date:                              2020-01-04 12:50:54\n\u003e        Last Modified Date:                         2019-09-04 04:43:27\n\u003e        Last Accessed Date:                         2020-01-04 12:50:54\n\u003e\n\u003e#3 (PK0102) [UTF-8] saint-petersburg.jpg\n\u003e----------------------------------------\n\u003e    - location:                                     2365435 (0x002417FB) bytes\n\u003e    - size:                                         102 bytes\n\u003e    part number of this part (0000):                1\n\u003e    relative offset of local header:                1380637 (0x0015111D) bytes\n\u003e    version made by operating system (00):          MS-DOS, OS/2, NT FAT\n\u003e    version made by zip software (31):              3.1\n\u003e    operat. system version needed to extract (00):  MS-DOS, OS/2, NT FAT\n\u003e    unzip software version needed to extract (20):  2.0\n\u003e    general purpose bit flag (0x0000) (bit 15..0):  0000.0000 0000.0000\n\u003e      file security status  (bit 0):                not encrypted\n\u003e      data descriptor       (bit 3):                no\n\u003e      strong encryption     (bit 6):                no\n\u003e      UTF-8 names          (bit 11):                no\n\u003e    compression method (08):                        deflate\n\u003e      compression sub-type (deflation):             normal\n\u003e    file last modified on (0x4F24 0x3D6D):          2019-09-04 07:43:26\n\u003e    32-bit CRC value:                               0x5F2EEF84\n\u003e    compressed size:                                984551 bytes\n\u003e    uncompressed size:                              1074836 bytes\n\u003e    length of filename:                             20\n\u003e                                                    UTF-8\n\u003e    73 61 69 6E 74 2D 70 65 74 65 72 73 62 75 72 67 saint-petersburg\n\u003e    2E 6A 70 67                                     .jpg\n\u003e    length of file comment:                         0 bytes\n\u003e    internal file attributes:                       0x0000\n\u003e      apparent file type:                           binary\n\u003e    external file attributes:                       0x00000020\n\u003e      WINDOWS   (0x20):                             arc\n\u003e      POSIX (0x000000):                             none\n\u003e    extra field:                                    2365501 (0x0024183D) bytes\n\u003e      - size:                                       36 bytes (1 record)\n\u003e    (0x000A) NTFS Timestamp:                        2365501 (0x0024183D) bytes\n\u003e      - size:                                       36 bytes\n\u003e      - total tags:                                 1\n\u003e      (0x0001) Tag1:                                24 bytes\n\u003e        Creation Date:                              2020-01-04 12:50:54\n\u003e        Last Modified Date:                         2019-09-04 04:43:27\n\u003e        Last Accessed Date:                         2020-01-04 12:50:54\n\u003e\n\u003e(PK0304) ZIP entries\n\u003e====================\n\u003e    total entries:                                  3\n\u003e\n\u003e#1 (PK0304) [UTF-8] cars/\n\u003e-------------------------\n\u003e    - location:                                     0 (0x00000000) bytes\n\u003e    - size:                                         35 bytes\n\u003e    operat. system version needed to extract (00):  MS-DOS, OS/2, NT FAT\n\u003e    unzip software version needed to extract (10):  1.0\n\u003e    general purpose bit flag (0x0000) (bit 15..0):  0000.0000 0000.0000\n\u003e      file security status  (bit 0):                not encrypted\n\u003e      data descriptor       (bit 3):                no\n\u003e      strong encryption     (bit 6):                no\n\u003e      UTF-8 names          (bit 11):                no\n\u003e    compression method (00):                        none (stored)\n\u003e    file last modified on (0x5024 0x7EC0):          2020-01-04 15:54:00\n\u003e    32-bit CRC value:                               0x00000000\n\u003e    compressed size:                                0 bytes\n\u003e    uncompressed size:                              0 bytes\n\u003e    length of filename:                             5\n\u003e                                                    UTF-8\n\u003e    63 61 72 73 2F                                  cars/\n\u003e\n\u003e#2 (PK0304) [UTF-8] cars/bentley-continental.jpg\n\u003e------------------------------------------------\n\u003e    - location:                                     35 (0x00000023) bytes\n\u003e    - size:                                         58 bytes\n\u003e    operat. system version needed to extract (00):  MS-DOS, OS/2, NT FAT\n\u003e    unzip software version needed to extract (20):  2.0\n\u003e    general purpose bit flag (0x0000) (bit 15..0):  0000.0000 0000.0000\n\u003e      file security status  (bit 0):                not encrypted\n\u003e      data descriptor       (bit 3):                no\n\u003e      strong encryption     (bit 6):                no\n\u003e      UTF-8 names          (bit 11):                no\n\u003e    compression method (08):                        deflate\n\u003e      compression sub-type (deflation):             normal\n\u003e    file last modified on (0x4F24 0x3D6D):          2019-09-04 07:43:26\n\u003e    32-bit CRC value:                               0x71797968\n\u003e    compressed size:                                1380544 bytes\n\u003e    uncompressed size:                              1395362 bytes\n\u003e    length of filename:                             28\n\u003e                                                    UTF-8\n\u003e    63 61 72 73 2F 62 65 6E 74 6C 65 79 2D 63 6F 6E cars/bentley-con\n\u003e    74 69 6E 65 6E 74 61 6C 2E 6A 70 67             tinental.jpg\n\u003e\n\u003e#3 (PK0304) [UTF-8] saint-petersburg.jpg\n\u003e----------------------------------------\n\u003e    - location:                                     1380637 (0x0015111D) bytes\n\u003e    - size:                                         50 bytes\n\u003e    operat. system version needed to extract (00):  MS-DOS, OS/2, NT FAT\n\u003e    unzip software version needed to extract (20):  2.0\n\u003e    general purpose bit flag (0x0000) (bit 15..0):  0000.0000 0000.0000\n\u003e      file security status  (bit 0):                not encrypted\n\u003e      data descriptor       (bit 3):                no\n\u003e      strong encryption     (bit 6):                no\n\u003e      UTF-8 names          (bit 11):                no\n\u003e    compression method (08):                        deflate\n\u003e      compression sub-type (deflation):             normal\n\u003e    file last modified on (0x4F24 0x3D6D):          2019-09-04 07:43:26\n\u003e    32-bit CRC value:                               0x5F2EEF84\n\u003e    compressed size:                                984551 bytes\n\u003e    uncompressed size:                              1074836 bytes\n\u003e    length of filename:                             20\n\u003e                                                    UTF-8\n\u003e    73 61 69 6E 74 2D 70 65 74 65 72 73 62 75 72 67 saint-petersburg\n\u003e    2E 6A 70 67                                     .jpg\n\u003e```\n\n**Note:** additional method `ZipInfo.printShortInfo(PrintStream)` could be used to print this info to required\n`PrintStream`\n\n#### Decompose zip file into `Path` destination\n```java\nPath zip = Paths.get(\"filename.zip\");\nPath destDir = Paths.get(\"/filename_decompose\");\nZipInfo.zip(zip).decompose(destDir);\n```\n\u003e```\n\u003efilename.zip\n\u003e  |-- cars\n\u003e  |    |-- bentley-continental.jpg\n\u003e  |-- saint-petersburg.jpg\n\u003e```\n\u003e```\n\u003e/filename_content\n\u003e  |-- central_directory\n\u003e  |    |-- #1 - cars\n\u003e  |    |    |-- extra_fields\n\u003e  |    |    |    |-- (0x000A)_NTFS_Timestamp.txt\n\u003e  |    |    |    |-- (0x000A)_NTFS_Timestamp.data\n\u003e  |    |    |-- file_header.txt\n\u003e  |    |    |-- file_header.data\n\u003e  |    |-- #2 - cars_-_bentley-continental.jpg\n\u003e  |    |    |-- extra_fields\n\u003e  |    |    |    |-- (0x000A)_NTFS_Timestamp.txt\n\u003e  |    |    |    |-- (0x000A)_NTFS_Timestamp.data\n\u003e  |    |    |-- file_header.txt\n\u003e  |    |    |-- file_header.data\n\u003e  |    |-- #3 - saint-petersburg.jpg\n\u003e  |    |    |-- extra_fields\n\u003e  |    |    |    |-- (0x000A)_NTFS_Timestamp.txt\n\u003e  |    |    |    |-- (0x000A)_NTFS_Timestamp.data\n\u003e  |    |    |-- file_header.txt\n\u003e  |    |    |-- file_header.data\n\u003e  |    |-- central_directory.txt\n\u003e  |-- entries\n\u003e  |    |-- #1 - cars\n\u003e  |    |    |-- local_file_header.txt\n\u003e  |    |    |-- local_file_header.data\n\u003e  |    |-- #2 - cars_-_bentley-continental.jpg\n\u003e  |    |    |-- local_file_header.txt\n\u003e  |    |    |-- local_file_header.data\n\u003e  |    |-- #3 - saint-petersburg.jpg\n\u003e  |    |    |-- file_header.txt\n\u003e  |    |    |-- file_header.data\n\u003e  |-- end_central_directory.txt\n\u003e  |-- end_central_directory.data\n\u003e```\n\n## Model\n\n### Zip settings: `ZipSettings`\n\nAll zip operations include `ZipSettings`. [Default settings](#zip-settings-defaults) is\nused when it's not explicitly set. Settings contains zip archive scope properties as well as\nprovider for entry specific settings. The key for entry settings is **fileName**.\n\n**Note:** user should not worry about directory marker `/`, because `zip4jvm` does not support\nduplicated file names and it's impossible to have same file name for file and directory.\n\n - _splitSize_ - size of each part in split archive\n   - `-1` - no split or solid archive\n   - _min size_ - `64Kb` i.e. `65_536`\n   - _min size_ - `~2Gb` i.e. `2_147_483_647`\n - _comment_ - global archive comment\n   - _no comment_ - `null` or `empty string`\n   - _max length_ - `65_535` symbols\n - _zip64_ - use `true` or not `false` zip64 format for global zip structure\n   - **Note:** _zip64_ is switched on automatically if needed\n   - **Note:** it does not mean that entry structure is in _zip64_ format as well\n - _entrySettingsProvider_ - file name base provider of settings for entry\n   - **Note:** each entry could have different settings\n\n#### Zip settings defaults\n\n - _splitSize_ - `-1`, i.e. off or solid archive\n - _comment_ - `null`, i.e. no comment\n - _zip64_ - `false`, i.e. standard format for global zip structure\n - _entrySettingsProvider_ - `default`, i.e. all entries has same [default entry settings](#zip-entry-settings-defaults)\n\n### Zip entry settings: `ZipEntrySettings`\n\nEach entry has it's own settings. These settings could be different for every entry. If this settings\nare not explicitly set, then `default` entry settings are used for all added entries.\n\n - _compression_ - compression algorithm\n   - `store` - no compression\n   - `deflate` - use [DEFLATE](https://en.wikipedia.org/wiki/DEFLATE) compression algorithm\n   - `enhanced_deflate` - use [ENHANCED DEFLATE](http://deflate64.com) compression algorithm\n   - `bzip2` - use [BZIP2](https://en.wikipedia.org/wiki/Bzip2) compression algorithm\n   - `lzma` - use [LZMA](https://en.wikipedia.org/wiki/Lempel%E2%80%93Ziv%E2%80%93Markov_chain_algorithm) compression algorithm\n - _compressionLevel_ - compression level\n   - `super_fast` `fast` `normal` `maximum`\n - _encryption_ - encryption algorithm\n   - `off` - not encryption\n   - `pkware` - [PKWare](https://en.wikipedia.org/wiki/PKWare) encryption algorithm\n   - `aes_128` `aes_192` `aes_256` - [AES](https://en.wikipedia.org/wiki/Advanced_Encryption_Standard)\n     encryption algorithm with given `128` `192` `255` bits key strength\n - _comment_ - comment for entry\n   - _no comment_ - `null` or `empty string`\n   - _max length_ - `65_535` symbols\n - _zip64_ - use `true` or `false` zip64 format for global zip structure\n   - **Note:** _zip64_ is switched on automatically if needed\n - _utf8_ - `true` use [UTF-8](https://en.wikipedia.org/wiki/UTF-8) charset for file name and comment\n   instead of [IBM-437](https://en.wikipedia.org/wiki/Code_page_437) when `false`\n\n#### Zip entry settings defaults\n\n - _compression_ - `deflate`\n - _compressionLevel_ - `normal`\n - _encryption_ - `off`, i.e. no encryption\n - _comment_ - `null`, i.e. no comment\n - _zip64_ - `false`, i.e. standard format for entry structure\n - _utf8_ - `true`, i.e. entry's name and comment are stored using `UTF-8` charset\n\n##### Links\n* Home page: https://github.com/oleg-cherednik/zip4jvm\n* Maven:\n  * **central:** https://mvnrepository.com/artifact/ru.oleg-cherednik.zip4jvm/zip4jvm\n  * **download:** https://repo1.maven.org/maven2/ru/oleg-cherednik/zip4jvm/zip4jvm/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foleg-cherednik%2Fzip4jvm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foleg-cherednik%2Fzip4jvm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foleg-cherednik%2Fzip4jvm/lists"}