List The Contents Of Zip File In Java Example

Chapter: ZIP Last Updated: 07-08-2017 15:44:51 UTC

Program:

            /* ............... START ............... */
                
import java.util.Enumeration;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;

public class JavaZipFileContent {
	public static void main(String[] args) throws Exception {
		ZipFile zipFile = new ZipFile("testfile.zip");

		Enumeration zipEntries = zipFile.entries();

		while (zipEntries.hasMoreElements()) {
			System.out.println(((ZipEntry) zipEntries.nextElement()).getName());
		}
	}
}
                /* ............... END ............... */
        

Notes:

  • Using zipFile.entries, we will get all the zip entries as Enumeration and by using iteration we can print name of the file.

Tags

List The Contents Of A Zip, Java

Similar Programs Chapter Last Updated
Zip Entry Is Directory Example In Java ZIP 23-04-2016
Create Zip File With CRC32 Checksum In Java ZIP 23-04-2016
Create Zip File With Adler32 Checksum In Java ZIP 23-04-2016
Extract Zip File With Adler32 Checksum In Java ZIP 23-04-2016
Extract File With CRC32 Checksum In Java ZIP 23-04-2016
CRC32 Checksum In Java ZIP 10-08-2016
Adler32 Checksum In Java ZIP 23-04-2016
Read Zip File Checksum Value In Java Example ZIP 20-07-2016
Create Checksum For Zip File In Java ZIP 07-08-2017
Decompress Zip File Using ZipInputStream In Java ZIP 20-07-2016
Read Entries In Zip File In Java Example ZIP 20-07-2016
Extract Contents Of Zip File In Java Example ZIP 07-08-2017
Zip File Creation In Java Example ZIP 23-06-2016

1