Differences between revisions 8 and 9
Revision 8 as of 2013-12-07 19:53:17
Size: 3373
Revision 9 as of 2017-02-04 16:17:55
Size: 3424
Comment: COMPRESS-381 - improve performance by buffering
Deletions are marked like this. Additions are marked like this.
Line 55: Line 55:
 {{{final OutputStream out = new FileOutputStream(output);  {{{final OutputStream out = new BufferedOutputStream(new FileOutputStream(output));
Line 61: Line 61:
 {{{final InputStream is = new FileInputStream(input);  {{{final InputStream is = new BufferedInputStream(new FileInputStream(input));

Component Overview

Compress is an API for working with the various archiving and compression formats.

Quick Start

*compress* is a stream based API. Some of it's original code came from Avalon's Excalibur, but originally from Ant, as far as life in Apache goes. It has migrated via: Ant -> Avalon-Excalibur -> Commons-IO -> Commons-Compress. More credits can be found in NOTICE.txt file.

*compress* divides the implementation in Compressors and Archivers. For each one an factory is implemented. Basically you have to get the stream implementation from the factory, create an entry, put this into the stream and stream.

Some experimental code makes it possible to modify archiver and compressor files. This means you can delete from for example a zip file.

Historical notes: There were discussion of "sponsoring" compress with code from TrueZip (https://truezip.dev.java.net/). The result was, not to include any code from this project (see mailinglists). There was a discussion about the complex file based implementation too. The result was to start again with a stream based implementation and move the old one to a branch. More information about the old implementation can be found on the CompressImplementationDetails page.


We're currenlty discussing a 2.0 API that fully embraces generics and tries to address a few pain points discovered over the years Compress 1.x has been around. If you want to help, here is the CompressRoadmap.


To pack an archive, you have to get an archiver stream via the ArchiverFactory. Add your streams to the archiver and stream. Archiver streams are: ZIP, CPIO, AR, TAR, JAR, DUMP. 7z, ARJ.

Creating a ZIP-File

Unpacking a ZIP-File


Same goes for Compressor. Compressor streams are: bz2, gz, lzma, xz, pack200, Z.

Compressing a file

Decompressing a file


  • Add your questions/answers here.

Compress (last edited 2017-02-04 16:17:55 by StefanBodewig)