Here you can find the source of getZipEntry(String zipFileLoc)
Parameter | Description |
---|---|
tarFileLoc | a parameter |
location | a parameter |
Parameter | Description |
---|---|
IOException | an exception |
public static Map<String, Long> getZipEntry(String zipFileLoc) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.FileInputStream; import java.io.IOException; import java.util.HashMap; import java.util.Map; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; public class Main { /**/*from w ww . jav a 2s.c o m*/ * Get File entries and size from a zip file... * * @param tarFileLoc * @param location * @throws IOException */ public static Map<String, Long> getZipEntry(String zipFileLoc) throws IOException { ZipInputStream zipIn = null; Map<String, Long> entryMap = null; try { zipIn = new ZipInputStream(new FileInputStream(zipFileLoc)); ZipEntry entry = zipIn.getNextEntry(); entryMap = new HashMap<String, Long>(); while (entry != null) { if (!entry.isDirectory()) { entryMap.put(entry.getName(), entry.getSize()); } zipIn.closeEntry(); entry = zipIn.getNextEntry(); } } finally { if (zipIn != null) { zipIn.close(); } } return entryMap; } }