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
1
vote
0 answers

Java un-compres 5G 7z file

I am trying to decompress a 5G text file with Apache commons compress version 1.9... public String unZipFile(String pathFileName, String saveFilePath) throws IOException { SevenZFile sevenZFile = new SevenZFile(new File(pathFileName)); …
Pedro Sosa
  • 39
  • 9
1
vote
3 answers

Read the content of CSV files inside a tar.gz archive

I want to save the contents of a tar.gz archive inside a database table. The archive contains txt files in CSV format. The idea is to insert a new line in the database for each line in the txt files. The problem is that I can't read the contents…
happy songs
  • 835
  • 8
  • 21
1
vote
0 answers

Unable to extract the zip64 archive using ZipInputStream with Java7 and Java8

I am using the below code to extract the files from zip archive. public static List unzipFiles(File zipFile, File targetDirectory) { List files = new ArrayList(); BufferedOutputStream dest = null; FileInputStream…
1
vote
1 answer

Java selectively copy files from a zip such that file timestamp should be preserved

I have followed following approach to decompress a zip using apache commons compress: But since I am using OutputStream & IOUtils.copy(ais, os); (code below) to unzip and copy file, the timestamp is not preserved. Is there another way to directly…
tryingToLearn
  • 10,691
  • 12
  • 80
  • 114
1
vote
1 answer

Progress information during Decompress / Unzip of an Archive

Currently I'm trying to get a progress information during the decompressing process of a zip file. I'm taking a deeper look into commons-compress which has all needed compress/decompress algos etc. but what I'm missing is a thing to get a progress…
khmarbaise
  • 92,914
  • 28
  • 189
  • 235
1
vote
1 answer

Apache Commons Compress unable to add hard link in tar

I have a set of files in which there are some hard links pointing to some of the files. For Example: /tmp/test/file1 /tmp/test/file1_Link The file1 is a file with size 1 MB. file1_Link is a hard link pointing to file1 When I use the unix tar…
1
vote
1 answer

How to check if TarArchiveEntry has any of the 3 execute bits set?

In commons-compress TarArchiveEntry one can ask for the mode using getMode(), however this returns an int. What is the best way to check if any of the execute bits (user, group, everyone) is set?
Axel Fontaine
  • 34,542
  • 16
  • 106
  • 137
1
vote
0 answers

Find specific file in 7zip archive

I'm using Apache Commons Compress to parse entries in a 7zip archive. I need to be able to find a specific file (e.g. "thisfile.xml"), I was wondering if there is a better way of doing it other than just looping through every entry in the…
J Lewis
  • 462
  • 1
  • 4
  • 15
1
vote
1 answer

Reading a large compressed file using Apache Commons Compress

I'm trying to read a bz2 file using Apache Commons Compress. The following code works for a small file. However for a large file (over 500MB), it ends after reading a few thousands lines without any error. try { InputStream fin = new…
Benben
  • 1,355
  • 5
  • 18
  • 31
1
vote
2 answers

Apache Common Compress - Split Zip file

I have successfully zip or unzip file by using Apache Common Compress library. Now the problem is, the compressed file needs to be send via FTP/email and 10 MB is the maximum limit of the file to be sent. So I need know the way to generate file(s)…
1
vote
1 answer

Add files and repertories to a Tar archive with Apache Commons Compress library in non machine dependent way

I'm working on an application that need to create a tar archive in order to calculate his hash. But I encounter some problems : the tar is not the same in different machine, then the hash calculated is different I'm not able to add directories…
MonkeyJLuffy
  • 195
  • 3
  • 15
1
vote
3 answers

How do I compress with commons compress in memory?

I am trying to bzip2 data in memory using commons compress. I am trying this: private static final int bufferSize = 8192; public void compress( ByteArrayInputStream byteArrayInputStream, CompressorOutputStream compressorOutputStream)…
1
vote
1 answer

Write byte array to ZipArchiveOutputStream

I need to create a zip file and am limited by the following conditions: The entries come as byte[] (or ByteArrayOutputStream) and not as File. The filenames for the entry can be non-ascii/UTF-8. JDK 1.6 or earlier Since java.util.zip only supports…
bz3x
  • 171
  • 4
  • 15
1
vote
1 answer

Adding an entry to nested zip File using commons.apache.compress

My Zip File structure is something like this: t1.zip --> t2.zip --> sample.txt I want to replace sample.txt. If it's one level, I was able to do it. Please help me with multi level nested zip files. My Sample Code ZipFile zipFile = new ZipFile(new…
Vinod Jayachandran
  • 3,726
  • 8
  • 51
  • 88
1
vote
2 answers

ZipArchiveInputStream created from InputStream, unable to read the content

Working Code : InputStream is = zipFile.getInputStream(zipArchiveEntry); BufferedReader br = new BufferedReader(new InputStreamReader(zis)); StringBuilder sb = new StringBuilder(); String line; while ((line = br.readLine()) != null) { …
Vinod Jayachandran
  • 3,726
  • 8
  • 51
  • 88