import java.io.*;import java.util.zip.*;/** * @author Hardneedl */public class ZipEntriesDemo { public static void main(String... args) throws IOException { ZipInputStream zipIn = new ZipInputStream(new FileInputStream(args[0])); ZipEntry zipEntry; while ( (zipEntry = zipIn.getNextEntry()) != null ) { zipIn.closeEntry(); if (!zipEntry.isDirectory()) { String name = zipEntry.getName(); long size = zipEntry.getSize(); long compd = zipEntry.getCompressedSize(); System.out.printf("%s , size=%d, compressed size=%d\r\n", name, size, compd); } } zipIn.close(); }}
取消
评论