Android Zip Entry Get GetFileList( String zipFileString, boolean bContainFolder, boolean bContainFile)

Here you can find the source of GetFileList( String zipFileString, boolean bContainFolder, boolean bContainFile)

Description

Get File List

License

Open Source License

Declaration

public static java.util.List<java.io.File> GetFileList(
        String zipFileString, boolean bContainFolder,
        boolean bContainFile) throws Exception 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {

    public static java.util.List<java.io.File> GetFileList(
            String zipFileString, boolean bContainFolder,
            boolean bContainFile) throws Exception {

        android.util.Log.v("XZip", "GetFileList(String)");

        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  ava2s.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;
    }
}

Related

  1. getEntryName(ZipEntry entry)
  2. getEntryName(ZipEntry entry)
  3. getEntryName(ZipEntry entry)
  4. getEntryName(ZipEntry entry)
  5. getEntryName(ZipEntry entry)
  6. GetFileList(String zipFileString, boolean bContainFolder, boolean bContainFile)
  7. GetFileList(String zipFileString, boolean bContainFolder, boolean bContainFile)
  8. isIgnore(final ZipEntry ze)
  9. getExtension(final ZipEntry ze)