commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Grobmeier <>
Subject Re: Compress: Reading archives within archives
Date Sat, 18 Apr 2009 18:07:49 GMT
Hi Marian,

thanks for using compress!

> I'm using Commons Compress to generate a list of all file names within an
> archive. This should also parse archive file within the archive to get a
> list of all files.
> However, I can't quite read the inner archive. For the outer archive, I have
> a file input stream "in", possibly a compressor input stream "cin", and an
> archive input stream "ain". Now whenever the next archive entry from ain
> turns out to be an archive file, I have to do create a new (possibly)
> compressor input stream and (definitely) archive input stream for the sub
> archive. Depending on which input stream I pass to the factory, I get two
> different errors:

Very interesting usecase, I didn't think about nested archives.

> 1) Pass archive input stream "ain" to the factory:
> java.lang.IllegalArgumentException: Mark is not supported.
>        at

this happens, if you use the autodetect feature from the factories.
Please wrap your inputstream in a bufferedinputstream (or anything
else which supports mark - i don't know others :-)) and the error
should dissappear

> 2) Pass file input stream "in" to the factory:
> This actually manages to get the file name, size and modification date of
> the first file within the sub archive (at least for ZIP files). However, I
> then get this exception:
> oversubscribed dynamic bit lengths tree
>        at
> And the input stream is broken for the archive input stream of the outer
> archive.

I have to check this out myself - but I assume this happens cause of
our random file access we use at the Zip classes. Means we read the
central directory of the zip archive first. This is only possible if
we have the file completly. I am guessing this is the problem here,
but maybe Stefan (who did tons of work on the zip classes) has more

> Am I doing something wrong? Is this a bug? Or is it at this time simply not
> possible to create archive input streams from "live" archive input streams
> without first decompressing the inner archive to a temp file?

I am quite sure its possible if you use option 1 with an
bufferedinputstream - let me know if that works.


> Thx,
> Marian.
> --
> View this message in context:
> Sent from the Commons - User mailing list archive at
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

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

View raw message