Questions tagged [apache-commons-compress]

Apache Commons Compress is a compression toolkit that supports several compression and archival formats not included with the Java programming language.

Apache Commons Compress is a component of the Apache Commons project. Apache Commons Compress is a compression and archival library, is open source software distributed under the Apache License, Version 2.0, and supports numerous formats including: ar, cpio, xz, and bzip2.

73 questions
14
votes
6 answers

Compress directory to tar.gz with Commons Compress

I'm running into a problem using the commons compress library to create a tar.gz of a directory. I have a directory structure that is as follows. parent/ child/ file1.raw fileN.raw I'm using the following code to do the…
awfulHack
  • 829
  • 1
  • 10
  • 24
12
votes
1 answer

apache commons compress using 7zip

i am trying to use the below code that i got from apache commons compress examples webpage to create a zip file using the sevenZ classes hoping it would be faster to compress than regular java zip. this is what my code looks like public static void…
md1980
  • 269
  • 4
  • 18
10
votes
1 answer

Read tar.gz in Java with Commons-compression

Ok so I want to read the contents of a tar.gz file (or a xy) but that's the same thing. What I am doing is more or less this: TarArchiveInputStream tarInput = new TarArchiveInputStream(new GzipCompressorInputStream(new…
zpontikas
  • 5,008
  • 2
  • 33
  • 40
7
votes
1 answer

Java utility library for Nested ZIP file handling

I am aware that Oracle notes ZIP/GZIP file compressor/decompressor methods on their website. But I have a scenario where I need to scan and find out whether any nested ZIPs/RARs are involved. For example, the following case: -MyFiles.zip …
ha9u63ar
  • 4,811
  • 7
  • 54
  • 80
7
votes
3 answers

How to convert ArchiveEntry to InputStream?

I'm reading a tar.gz archive using ArchiveEntry entry = tarArchiveInputStream.getNextEntry(); Question: how can I convert this ArchiveEntry to an InputStream so I can actually read and process the file to a String?
membersound
  • 66,525
  • 139
  • 452
  • 886
7
votes
1 answer

Gradle Does Not Include Optional Dependency

I have a project which has the apache-compress library as a compile time dependency. This library appears to use Maven and has a POM file with a dependency set up as "optional". Here is the relevant section of the POM file:
jjathman
  • 12,156
  • 7
  • 27
  • 33
5
votes
1 answer

Preview .7z content and subfolders without extracting

I would like to preview the content of a .7z without extracting it with Java, so i tried with Apache Commons Compress : public static void main(String[] args) { try { SevenZFile sevenZFile = new SevenZFile(new File("C://test.7z")); …
Denis Cucchietti
  • 201
  • 4
  • 15
5
votes
1 answer

Apache Commons Compress: Opening .tar.gz

I'm developing a software that will get information from tar.gz files and I'm using the Apache commons-compress lib. But I'm getting the following error: Caused by: java.lang.IllegalArgumentException: Invalid byte 4 at offset 0 in 'O�!�C' len=8 at…
5
votes
1 answer

How to append files to a .tar archive using Apache Commons Compress?

I read How do I append files to a tar archive in java?, append files to an archive without reading/rewriting the whole archive and Add an entry to a tar file without overwriting its existing contents but no good answer was given. Moreover I do not…
Maxbester
  • 2,207
  • 7
  • 37
  • 64
4
votes
3 answers

Java Compression Library To Support Deflate64

Looking for an alternative compression java library to Apache Commons Compress (https://commons.apache.org/proper/commons-compress/). Commons Compress throws an error when trying to read a zip entry that was compressed using "ENHANCED_DEFLATED"…
4
votes
3 answers

Parallel BZip2 Compression

i'm using Apache Commons Compress for Java to compress multiple log files to a single tar.bz2 archive. However, it takes really long (> 12 hours) to compress, because i compress around 20GB of files a day. As this library compresses files…
Stefan
  • 2,129
  • 2
  • 31
  • 53
3
votes
1 answer

Getting java.io.EOFException while reading a SQLite file from temp directory

I am seeing an EOFException exception while reading a SQLite file from temp directory. Following is the code for reading the file. And also the exception is not seen always. Consider out of 50K files it is coming for 3 to 4 times. public static…
Arpan Das
  • 841
  • 1
  • 15
  • 50
3
votes
1 answer

java.io.IOException: Error detected parsing the header , Unpacking .tgz file in Java

I'm using apache commons to unpack .tgz files. I am getting an error from the compress library. I have tried compress versions 1.9 and 1.8.1 and I am still having the same errors. This is only happening on certain files but the kicker is when I…
user2183985
  • 75
  • 2
  • 8
3
votes
1 answer

java.util.zip.ZipException: invalid stored block lengths

I am trying to read a ZipArchiveEntry to String. I have the below code and i run into exception My code is as below StringWriter writer = new StringWriter(); IOUtils.copy(zipFile.getInputStream(zipArchiveEntry), writer, …
Vinod Jayachandran
  • 3,208
  • 5
  • 31
  • 64
2
votes
1 answer

Exception happened when untarring the Tar file using Apache Commons compress

I am trying to untar the tar file to a map using Apache commons compress in Java. I am able to untar most of the tar files but few are failing with the below Exception. I am not sure what is causing the issue. is the tar file corrupted? I am able to…
sparker
  • 1,640
  • 3
  • 15
  • 30
1
2 3 4 5