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.

87 questions
16
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
  • 319
  • 1
  • 8
  • 21
16
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
  • 857
  • 1
  • 10
  • 25
12
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,445
  • 2
  • 37
  • 41
8
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,536
  • 8
  • 29
  • 33
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 …
ha9u63a7
  • 6,233
  • 16
  • 73
  • 108
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
  • 81,582
  • 193
  • 585
  • 1,120
6
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…
6
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,435
  • 7
  • 42
  • 70
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
  • 6
  • 16
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"…
cjablonski76
  • 173
  • 1
  • 13
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,028
  • 2
  • 36
  • 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
  • 1,015
  • 3
  • 24
  • 57
3
votes
1 answer

What's the fastest and most memory efficient BZip2 decompression tool to use in Java

Currently using the Apache Commons Compress package which uses about 60% of the overall heap and takes around 6 minutes to decompress about 500 files each 4-5Mb when decompressing BZip2 files. My main problem is I can't find anything to compare this…
3
votes
1 answer

Commons Compress using 7z gives Stream is not in the BZip2 format

I have this password protected 7z archive that can be properly opened and extracted with 7z alone. But using the code below: byte[] PASSWORD = "secret".getBytes(); String fileName = "r:/txt.7z"; SevenZArchiveEntry entry; try…
Cromax
  • 1,822
  • 1
  • 23
  • 35
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
1
2 3 4 5 6