列出Zip包下面所有文件

ZipFile file = new ZipFile(fileName);

		Enumeration entries = file.entries();
		while (entries.hasMoreElements()) {
			ZipEntry entry = (ZipEntry) entries.nextElement();
			String entryName = entry.getName();
			System.out.println("entryName:" + entryName + "  "
					+ entry.isDirectory());

			byte[] tempbytes = new byte[100];
			InputStream in = file.getInputStream(entry);
			int byteread = 0;
			while ((byteread = in.read(tempbytes)) != -1) {
				System.out.write(tempbytes, 0, byteread);
			}

		}
 

你可能感兴趣的:(zip)