Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
org.rauschig:jarchivelib
Advanced tools
A simple library that facades org.apache.commons.compress, to provide an easy-to-use API for archiving and compressing into and out of File objects.
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.
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"));
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);
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.
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();
jarchivelib compiles to a bundle and is OSGi compatible
FAQs
A simple library that facades org.apache.commons.compress, to provide an easy-to-use API for archiving and compressing into and out of File objects.
We found that org.rauschig:jarchivelib demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.