{"id":17929656,"url":"https://github.com/thrau/jarchivelib","last_synced_at":"2025-04-04T10:07:32.525Z","repository":{"id":7713313,"uuid":"9078526","full_name":"thrau/jarchivelib","owner":"thrau","description":"A simple archiving and compression library for Java","archived":false,"fork":false,"pushed_at":"2024-05-21T12:47:15.000Z","size":211,"stargazers_count":200,"open_issues_count":31,"forks_count":38,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-03-27T05:08:42.285Z","etag":null,"topics":["archiving","compression","extraction"],"latest_commit_sha":null,"homepage":"https://github.com/thrau/jarchivelib","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/thrau.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}},"created_at":"2013-03-28T14:15:03.000Z","updated_at":"2024-12-10T00:08:54.000Z","dependencies_parsed_at":"2022-08-30T10:42:14.275Z","dependency_job_id":"14285110-9f02-4666-a0fe-3baf8d0d7ae7","html_url":"https://github.com/thrau/jarchivelib","commit_stats":{"total_commits":164,"total_committers":8,"mean_commits":20.5,"dds":0.09146341463414631,"last_synced_commit":"4b3d39f313f613dbb08cbda8888e6cb9e279c124"},"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thrau%2Fjarchivelib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thrau%2Fjarchivelib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thrau%2Fjarchivelib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thrau%2Fjarchivelib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thrau","download_url":"https://codeload.github.com/thrau/jarchivelib/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247157281,"owners_count":20893220,"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":["archiving","compression","extraction"],"created_at":"2024-10-28T21:09:58.555Z","updated_at":"2025-04-04T10:07:32.498Z","avatar_url":"https://github.com/thrau.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"jarchivelib\n===========\n\n[![Maven Central](https://maven-badges.herokuapp.com/maven-central/org.rauschig/jarchivelib/badge.svg)](https://maven-badges.herokuapp.com/maven-central/org.rauschig/jarchivelib/)\n[![Build Status](https://travis-ci.org/thrau/jarchivelib.svg?branch=master)](https://travis-ci.org/thrau/jarchivelib)\n[![Coverage Status](https://coveralls.io/repos/thrau/jarchivelib/badge.svg)](https://coveralls.io/r/thrau/jarchivelib)\n\nA simple archiving and compression library for Java that provides a thin and easy-to-use API layer on top of the\npowerful and feature-rich [org.apache.commons.compress].\n\n  [org.apache.commons.compress]: http://commons.apache.org/proper/commons-compress/\n\nUsage\n-----\n### Using the ArchiverFactory\nCreate a new Archiver to handle zip archives\n\n```java\nArchiver archiver = ArchiverFactory.createArchiver(ArchiveFormat.ZIP);\n```\n\n\nCreate a new Archiver to handle tar archives with gzip compression\n\n```java\nArchiver archiver = ArchiverFactory.createArchiver(ArchiveFormat.TAR, CompressionType.GZIP);\n```\n\n\nAlternatively you can use string representations of the archive and compression types.\n\n```java\nArchiver archiver = ArchiverFactory.createArchiver(\"zip\");\n```\n\nThe ArchiveFactory can also detect archive types based on file extensions and hand you the correct Archiver. This\nexample returns an Archiver instance that handles tar.gz files. (It would also recognize the `.tgz` extension)\n\n```java\nArchiver archiver = ArchiverFactory.createArchiver(new File(\"archive.tar.gz\"));\n```\n\n### Using Archivers\n#### Extract\nTo extract the zip archive `/home/jack/archive.zip` to `/home/jack/archive`:\n\n```java\nFile archive = new File(\"/home/jack/archive.zip\");\nFile destination = new File(\"/home/jack/archive\");\n\nArchiver archiver = ArchiverFactory.createArchiver(ArchiveFormat.ZIP);\narchiver.extract(archive, destination);\n```\n\n#### Create\nTo create a new tar archive with gzip compression `archive.tar.gz` in `/home/jack/` containing the entire directory `/home/jack/archive`\n\n```java\nString archiveName = \"archive\";\nFile destination = new File(\"/home/jack\");\nFile source = new File(\"/home/jack/archive\");\n\nArchiver archiver = ArchiverFactory.createArchiver(ArchiveFormat.TAR, CompressionType.GZIP);\nFile archive = archiver.create(archiveName, destination, source);\n```\n\nnotice that you can omit the filename extension in the archive name, as it will be appended by the archiver automatically if it is missing.\n\n\n#### Stream\n\nTo access the contents of an archive as a Stream, rather than extracting them directly onto the filesystem\n\n```java\nArchiveStream stream = archiver.stream(archive);\nArchiveEntry entry;\n\nwhile((entry = stream.getNextEntry()) != null) {\n    // access each archive entry individually using the stream\n    // or extract it using entry.extract(destination)\n    // or fetch meta-data using entry.getName(), entry.isDirectory(), ...\n}\nstream.close();\n```\n\nDependencies\n------------\n\n* commons-compress(tm) 1.21\n\n\nCompatibility\n-------------\n\n* Java 7, 8, 9, 10, 14\n* Currently only tested for *nix file systems.\n\n### OSGi\n\njarchivelib compiles to a bundle and is OSGi compatible\n\n### jarchivelib 0.8.x and below\n\n* Java 6 and 7\n\n\nKnown limitations\n-----------------\n\n* Permissions are not stored when creating archives\n* There is no support for Windows permissions\n* JAR files are treated like streamed zip files and can not restore permissions\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthrau%2Fjarchivelib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthrau%2Fjarchivelib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthrau%2Fjarchivelib/lists"}