commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <>
Subject Re: append to gzip or bz2
Date Wed, 30 Mar 2011 04:05:18 GMT
On 2011-03-30, Alexander Gubin wrote:

> Does commons-compress support appending to compressed files?

In general the compression formats don't support appending.

Many algorithms are block based (bzip is one) and if your original
data's length isn't an exact multiple of the block size (which in
general it is not) the final block must be marked in some way and will
be padded.

If you append to such a file any tool reading the compressed file will
see the marked block and stop extracting there - not seeing the data
you've appended ever.

The only proper way append could work was by reading the original stream
and writing it again compressing but not closing it.  This can not be
done by simply making the OutputStream one that was opened in some sort
of append mode.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message