Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compression level using Apache Commons Compress

I'm trying to find settings for compression level in Apache Commons Compress lib for tar and gzip archive types.

Could you please tell is it supported by the library? If yes, how can I configure it?

like image 537
VextoR Avatar asked Aug 20 '26 09:08

VextoR


2 Answers

You can't.

First, tar does not compress at all; it's simply an archive format.

Second, gzip uses a single compression type, deflate. Compression schemes that allow "levels" uses those levels to select between algorithms (or, in the case of lossy compression, how much information to discard).

like image 170
parsifal Avatar answered Aug 22 '26 00:08

parsifal


tar is not a compressed format on its own, it just bundles multiple files into a single one (hence the name, the files stick together just like they were covered in tar).

You cannot change the compression level, if you need better compression, use bzip2 instead of gzip.

like image 45
us2012 Avatar answered Aug 22 '26 00:08

us2012