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

14
LINES

< > BotCompany Repo | #1012228 // extractFileFromZipFile

JavaX fragment (include)

1  
static void extractFileFromZipFile(File inZip, S fileName, File destFile) ctex {
2  
  ZipFile zip = new ZipFile(inZip);
3  
  try {
4  
    extractFileFromZipFile(zip, fileName, destFile);
5  
  } finally {
6  
    zip.close();
7  
  }
8  
}
9  
    
10  
static void extractFileFromZipFile(ZipFile zip, S fileName, File destFile) ctex {
11  
  ZipEntry entry = zip.getEntry(fileName);
12  
  if (entry == null) fail("File not found in zip: " + zip + " / " + fileName);
13  
  saveStream(zip.getInputStream(entry), destFile);
14  
}

Author comment

Began life as a copy of #1002031

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1012228
Snippet name: extractFileFromZipFile
Eternal ID of this version: #1012228/1
Text MD5: f69b01240b5b79cc614139b018856fa6
Author: stefan
Category: javax / i.o.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-11-24 13:27:13
Source code size: 489 bytes / 14 lines
Pitched / IR pitched: No / No
Views / Downloads: 365 / 385
Referenced in: [show references]