public String[] list(String path) throws IOException {
  if (path.startsWith("/")) {
    path=path.substring(1);
  }
  if (!path.endsWith("/")) {
    path=path + "/";
  }
  ArrayList<String> names=new ArrayList<>();
  ZipFile zipFile=getZipFile();
  try {
    Enumeration<? extends ZipEntry> e=zipFile.entries();
    while (e.hasMoreElements()) {
      ZipEntry entry=e.nextElement();
      String name=entry.getName();
      if (name.startsWith(path)) {
        String tail=name.substring(path.length());
        int p=tail.indexOf('/');
        if (p >= 0) {
          tail=tail.substring(0,p);
        }
        if (!tail.equals("") && !names.contains(tail)) {
          names.add(tail);
        }
      }
    }
  }
  finally {
    closeZipFile(zipFile);
  }
  String[] list=new String[names.size()];
  names.toArray(list);
  return list;
}

public String [ ] list ( String path ) throws IOException { if ( path . startsWith ( "/" ) ) { path = path . substring ( 1 ) ; } if ( ! path . endsWith ( "/" ) ) { path = path + "/" ; } ArrayList < String > names = new ArrayList < > ( ) ; ZipFile zipFile = getZipFile ( ) ; try { Enumeration < ? extends ZipEntry > e = zipFile . entries ( ) ; while ( e . hasMoreElements ( ) ) { ZipEntry entry = e . nextElement ( ) ; String name = entry . getName ( ) ; if ( name . startsWith ( path ) ) { String tail = name . substring ( path . length ( ) ) ; int p = tail . indexOf ( '/' ) ; if ( p >= 0 ) { tail = tail . substring ( 0 , p ) ; } if ( ! tail . equals ( "" ) && ! names . contains ( tail ) ) { names . add ( tail ) ; } } } } finally { closeZipFile ( zipFile ) ; } String [ ] list = new String [ names . size ( ) ] ; names . toArray ( list ) ; return list ; }
lists all the files in this directory .
