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

18
LINES

< > BotCompany Repo | #1022702 // listZipEntries

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<ZipEntry> listZipEntries(File inZip) ctex {
4  
  if (inZip == null) null;
5  
  temp ZipFile zipFile = new ZipFile(inZip);
6  
  ret listZipEntries(zipFile);
7  
}
8  
    
9  
static L<ZipEntry> listZipEntries(ZipFile zipFile) ctex {
10  
  new L<ZipEntry> list;
11  
  Enumeration entries = zipFile.entries();
12  
  while (entries.hasMoreElements()) {
13  
    ZipEntry entry = cast entries.nextElement(); 
14  
    if (!entry.isDirectory())
15  
      list.add(entry);
16  
  }
17  
  ret list;
18  
}

Author comment

Began life as a copy of #1002029

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1022702
Snippet name: listZipEntries
Eternal ID of this version: #1022702/3
Text MD5: 64331f5378a607fea8b49d39dafe96b1
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-08-30 11:54:39
Source code size: 570 bytes / 18 lines
Pitched / IR pitched: No / No
Views / Downloads: 323 / 372
Version history: 2 change(s)
Referenced in: [show references]