The Java Developers Almanac 1.4


Order this book from Amazon.

   
Home > List of Packages > java.util.zip  [9 examples] > ZIP  [3 examples]

e454. Listing the Contents of a ZIP File

    try {
        // Open the ZIP file
        ZipFile zf = new ZipFile("filename.zip");
    
        // Enumerate each entry
        for (Enumeration entries = zf.entries(); entries.hasMoreElements();) {
            // Get the entry name
            String zipEntryName = ((ZipEntry)entries.nextElement()).getName();
        }
    } catch (IOException e) {
    }

 Related Examples
e453. Creating a ZIP File
e455. Retrieving a Compressed File from a ZIP File

See also: Checksums    GZIP   


© 2002 Addison-Wesley.