commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexander Gubin <aggu...@gmail.com>
Subject Re: append to gzip or bz2
Date Wed, 30 Mar 2011 05:59:42 GMT
got it, thanks Stefan


On Tue, Mar 29, 2011 at 9:05 PM, Stefan Bodewig <bodewig@apache.org> wrote:
> 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.
>
> Stefan
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message