On 2014-01-02, Jesse Glick wrote:
> On Thu, Jan 2, 2014 at 2:22 AM, <[email protected]> wrote:
>+ try {
>+ jarFile = new JarFile(file);
>+ } catch (ZipException notAJar) {
>+ // raised if a file that is not a ZIP
> Would also be thrown if the file _is_ a ZIP file but there was some
> (potentially significant) error opening it.
Right.
> Could consider checking the file header for the magic sequence {0x50,
> 0x4b, 0x03, 0x04} and rethrowing the exception. (Have observed {0x50,
> 0x4b, 0x05, 0x06} in empty archives as well,
or PK00. I know, I spent some time with the format :-)
You are right, of course, will port over ZipArchiveInputStream#matches
from Commons Compress.
Stefan
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]