commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Grobmeier <grobme...@gmail.com>
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:
>
> java.util.zip.ZipException: oversubscribed dynamic bit lengths tree
>        at
> org.apache.commons.compress.archivers.zip.ZipArchiveInputStream.read(ZipArchiveInputStream.java:236)
>
> 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
ideas.


> 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.

Thanks,
Christian

>
> Thx,
> Marian.
>
> --
> View this message in context: http://www.nabble.com/Compress%3A-Reading-archives-within-archives-tp23107917p23107917.html
> Sent from the Commons - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> 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