Android examples for File Input Output:Zip File
Get File List from zip file
//package com.java2s; public class Main { public static java.util.List<java.io.File> GetFileList( String zipFileString, boolean bContainFolder, boolean bContainFile) throws Exception { java.util.List<java.io.File> fileList = new java.util.ArrayList<java.io.File>(); java.util.zip.ZipInputStream inZip = new java.util.zip.ZipInputStream( new java.io.FileInputStream(zipFileString)); java.util.zip.ZipEntry zipEntry; String szName = ""; while ((zipEntry = inZip.getNextEntry()) != null) { szName = zipEntry.getName(); if (zipEntry.isDirectory()) { // get the folder name of the widget szName = szName.substring(0, szName.length() - 1); java.io.File folder = new java.io.File(szName); if (bContainFolder) { fileList.add(folder); }// ww w . j a v a 2 s . c o m } else { java.io.File file = new java.io.File(szName); if (bContainFile) { fileList.add(file); } } }//end of while inZip.close(); return fileList; } }