Java examples for File Path IO:Zip File
Get Compressed Size of Zip Entry
import java.io.IOException; import java.util.Enumeration; import java.util.zip.ZipEntry; import java.util.zip.ZipFile; public class Main { public static void main(String args[]) { try {/* w ww. j a v a 2s . co m*/ ZipFile zipFile = new ZipFile("c:/Folder/WebFiles.zip"); Enumeration e = zipFile.entries(); System.out.print("File Name"); System.out.print("\t\t\t\tCompressed Size"); while (e.hasMoreElements()) { ZipEntry entry = (ZipEntry) e.nextElement(); String entryName = entry.getName(); long compressedSize = entry.getCompressedSize(); System.out.print(entryName); System.out.print("\t\t\t\t" + compressedSize); System.out.print("\n"); } zipFile.close(); } catch (IOException ioe) { System.out.println("Error opening zip file" + ioe); } } }