Search This Blog

Java: list contents of a zip archive

public class Test {

    public static void main(String[] args) {
        ZipFile zf = new ZipFile("/tmp/1.zip");
        Enumeration<? extends ZipEntry> entries = zf.entries();
        while(entries.hasMoreElements()){
            ZipEntry e = entries.nextElement();
            System.out.println(e.getName()+"\t"+e.getSize());
        }
    }
}

No comments:

Post a Comment