Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

26
LINES

< > BotCompany Repo | #1002029 // listZipFile

JavaX fragment (include)

1  
// lists files only - who needs to list directories?!
2  
// lists in typical .zip fashion - dir1/dir2/bla.txt
3  
static L<S> listZipFile(File inZip) ctex {
4  
  ZipFile zipFile = new ZipFile(inZip);
5  
  try {
6  
    ret listZipFile(zipFile);
7  
  } finally {
8  
    zipFile.close();
9  
  }
10  
}
11  
    
12  
static L<S> listZipFile(ZipFile zipFile) ctex {
13  
  new L<S> list;
14  
  Enumeration entries = zipFile.entries();
15  
  while (entries.hasMoreElements()) {
16  
    ZipEntry entry = (ZipEntry) entries.nextElement(); 
17  
    if (!entry.isDirectory())
18  
      list.add(entry.getName());
19  
  }
20  
  ret list;
21  
}
22  
23  
static L<S> listZipFile(S name) {
24  
  if (isSnippetID(name)) ret listZipFile(loadLibrary(name));
25  
  ret listZipFile(getProgramFile(name));
26  
}

Author comment

Began life as a copy of #1001173

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ekrmjmnbrukm, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1002029
Snippet name: listZipFile
Eternal ID of this version: #1002029/2
Text MD5: 6d7856b090531fa345f371744051e18a
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-06-14 13:25:28
Source code size: 720 bytes / 26 lines
Pitched / IR pitched: No / No
Views / Downloads: 693 / 943
Version history: 1 change(s)
Referenced in: [show references]