Here you can find the source of getFileNamesOld(File zipFile)
http://www.java2novice.com/java-collections-and-util/zip/file-list/
Parameter | Description |
---|---|
zipFile | a parameter |
public static List<String> getFileNamesOld(File zipFile)
//package com.java2s; //License from project: Apache License import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.Enumeration; import java.util.List; import java.util.zip.ZipEntry; import java.util.zip.ZipException; import java.util.zip.ZipFile; public class Main { /**/*from w w w .ja va2 s.c o m*/ * http://www.java2novice.com/java-collections-and-util/zip/file-list/ * * @param zipFile * @return */ public static List<String> getFileNamesOld(File zipFile) { List<String> filenames = new ArrayList<>(); ZipFile z; try { z = new ZipFile(zipFile); Enumeration<? extends ZipEntry> en = z.entries(); while (en.hasMoreElements()) { ZipEntry ze = en.nextElement(); filenames.add(ze.getName()); } z.close(); } catch (ZipException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return filenames; } }