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

26
LINES

< > BotCompany Repo | #1002029 // listZipFile

JavaX fragment (include)

// lists files only - who needs to list directories?!
// lists in typical .zip fashion - dir1/dir2/bla.txt
static L<S> listZipFile(File inZip) ctex {
  ZipFile zipFile = new ZipFile(inZip);
  try {
    ret listZipFile(zipFile);
  } finally {
    zipFile.close();
  }
}
    
static L<S> listZipFile(ZipFile zipFile) ctex {
  new L<S> list;
  Enumeration entries = zipFile.entries();
  while (entries.hasMoreElements()) {
    ZipEntry entry = (ZipEntry) entries.nextElement(); 
    if (!entry.isDirectory())
      list.add(entry.getName());
  }
  ret list;
}

static L<S> listZipFile(S name) {
  if (isSnippetID(name)) ret listZipFile(loadLibrary(name));
  ret listZipFile(getProgramFile(name));
}

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: 789 / 1047
Version history: 1 change(s)
Referenced in: [show references]