public static void main(String[] args) throws Exception {
        if (args.length == 0) {
            System.err.println("Usage: java -jar sezpoz.jar [ something.jar | some.serialized.Annotation ]+");
        }
        for (String arg : args) {
            System.out.println("--- " + arg);
            byte[] magic = new byte[4];
            InputStream is = new FileInputStream(arg);
            try {
                is.read(magic, 0, 4);
            } finally {
                is.close();
            }
            if (Arrays.equals(magic, ZIP_MAGIC)) {
                JarFile jf = new JarFile(arg, false);
                try {
                    Enumeration<JarEntry> entries = jf.entries();
                    while (entries.hasMoreElements()) {
                        JarEntry entry = entries.nextElement();
                        String name = entry.getName();
                        if (name.startsWith(Indexer.METAINF_ANNOTATIONS)) {
                            String annotation = name.substring(Indexer.METAINF_ANNOTATIONS.length());
                            if (annotation.isEmpty() || annotation.endsWith(".txt")) {
                                continue;
                            }
                            System.out.println("# " + annotation);
                            is = jf.getInputStream(entry);
                            try {
                                is.read(magic, 0, 4);
                            } finally {
                                is.close();
                            }
                            if ((Arrays.equals(magic, SER_MAGIC))) {
                                is = jf.getInputStream(entry);
                                try {
                                    dump(is);
                                } finally {
                                    is.close();
                                }
                            } else {
                                System.err.println("does not look like a Java serialized file");
                            }
                        }
                    }
                } finally {
                    jf.close();
                }
            } else if (Arrays.equals(magic, SER_MAGIC)) {
                is = new FileInputStream(arg);
                try {
                    dump(is);
                } finally {
                    is.close();
                }
            } else {
                System.err.println("does not look like either a JAR file or a Java serialized file");
            }
        }
    }