All Projects → thrau → Jarchivelib

thrau / Jarchivelib

Licence: apache-2.0
A simple archiving and compression library for Java

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Jarchivelib

Bit7z
A C++ static library offering a clean and simple interface to the 7-zip DLLs.
Stars: ✭ 159 (-1.85%)
Mutual labels:  extraction, compression
SevenZipSharp
Fork of SevenZipSharp on CodePlex
Stars: ✭ 171 (+5.56%)
Mutual labels:  compression, extraction
Bareos
Main repository with the code for the libraries and daemons
Stars: ✭ 651 (+301.85%)
Mutual labels:  archiving, compression
Digital video introduction
A hands-on introduction to video technology: image, video, codec (av1, vp9, h265) and more (ffmpeg encoding).
Stars: ✭ 12,184 (+7420.99%)
Mutual labels:  compression
Android Otp Extractor
Extracts OTP tokens from rooted Android devices
Stars: ✭ 147 (-9.26%)
Mutual labels:  extraction
Pygm
🐍 Python library implementing sorted containers with state-of-the-art query performance and compressed memory usage
Stars: ✭ 156 (-3.7%)
Mutual labels:  compression
Wikipedia Mirror
🌐 Guide and tools to run a full offline mirror of Wikipedia.org with three different approaches: Nginx caching proxy, Kimix + ZIM dump, and MediaWiki/XOWA + XML dump
Stars: ✭ 160 (-1.23%)
Mutual labels:  archiving
Junrar
Plain Java unrar library
Stars: ✭ 142 (-12.35%)
Mutual labels:  compression
Zstd Rs
A rust binding for the zstd compression library.
Stars: ✭ 159 (-1.85%)
Mutual labels:  compression
Texture Compressor
CLI tool for texture compression using ASTC, ETC, PVRTC and S3TC in a KTX container.
Stars: ✭ 156 (-3.7%)
Mutual labels:  compression
Acl Ue4 Plugin
The official Animation Compression Library Unreal Engine 4 plugin
Stars: ✭ 156 (-3.7%)
Mutual labels:  compression
Gorilla Tsc
Implementation of time series compression method from the Facebook's Gorilla paper
Stars: ✭ 147 (-9.26%)
Mutual labels:  compression
Autolink Java
Java library to extract links (URLs, email addresses) from plain text; fast, small and smart
Stars: ✭ 157 (-3.09%)
Mutual labels:  extraction
Lzsa
Byte-aligned, efficient lossless packer that is optimized for fast decompression on 8-bit micros
Stars: ✭ 146 (-9.88%)
Mutual labels:  compression
Flutter luban
An image compress package like Luban for Dart
Stars: ✭ 154 (-4.94%)
Mutual labels:  compression
Zeroq
[CVPR'20] ZeroQ: A Novel Zero Shot Quantization Framework
Stars: ✭ 150 (-7.41%)
Mutual labels:  compression
Georaptor
Python Geohash Compression Tool
Stars: ✭ 143 (-11.73%)
Mutual labels:  compression
Tinydeflate
A deflate/gzip decompressor that requires minimal amount of memory to work
Stars: ✭ 148 (-8.64%)
Mutual labels:  compression
Python Lz4
LZ4 bindings for Python
Stars: ✭ 156 (-3.7%)
Mutual labels:  compression
Compactgui
Visual Interface for the Windows 10 Compact Function
Stars: ✭ 2,103 (+1198.15%)
Mutual labels:  compression

jarchivelib

Maven Central Build Status Coverage Status

A simple archiving and compression library for Java that provides a thin and easy-to-use API layer on top of the powerful and feature-rich org.apache.commons.compress.

Usage

Using the ArchiverFactory

Create a new Archiver to handle zip archives

Archiver archiver = ArchiverFactory.createArchiver(ArchiveFormat.ZIP);

Create a new Archiver to handle tar archives with gzip compression

Archiver archiver = ArchiverFactory.createArchiver(ArchiveFormat.TAR, CompressionType.GZIP);

Alternatively you can use string representations of the archive and compression types.

Archiver archiver = ArchiverFactory.createArchiver("zip");

The ArchiveFactory can also detect archive types based on file extensions and hand you the correct Archiver. This example returns an Archiver instance that handles tar.gz files. (It would also recognize the .tgz extension)

Archiver archiver = ArchiverFactory.createArchiver(new File("archive.tar.gz"));

Using Archivers

Extract

To extract the zip archive /home/jack/archive.zip to /home/jack/archive:

File archive = new File("/home/jack/archive.zip");
File destination = new File("/home/jack/archive");

Archiver archiver = ArchiverFactory.createArchiver(ArchiveFormat.ZIP);
archiver.extract(archive, destination);

Create

To create a new tar archive with gzip compression archive.tar.gz in /home/jack/ containing the entire directory /home/jack/archive

String archiveName = "archive";
File destination = new File("/home/jack");
File source = new File("/home/jack/archive");

Archiver archiver = ArchiverFactory.createArchiver(ArchiveFormat.TAR, CompressionType.GZIP);
File archive = archiver.create(archiveName, destination, source);

notice that you can omit the filename extension in the archive name, as it will be appended by the archiver automatically if it is missing.

Stream

To access the contents of an archive as a Stream, rather than extracting them directly onto the filesystem

ArchiveStream stream = archiver.stream(archive);
ArchiveEntry entry;

while((entry = stream.getNextEntry()) != null) {
    // access each archive entry individually using the stream
    // or extract it using entry.extract(destination)
    // or fetch meta-data using entry.getName(), entry.isDirectory(), ...
}
stream.close();

Dependencies

  • commons-compress(tm) 1.20

Compatibility

  • Java 7, 8, 9, 10, 14
  • Currently only tested for *nix file systems.

OSGi

jarchivelib compiles to a bundle and is OSGi compatible

jarchivelib 0.8.x and below

  • Java 6 and 7

Known limitations

  • Permissions are not stored when creating archives
  • There is no support for Windows permissions
  • JAR files are treated like streamed zip files and can not restore permissions
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].