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

17
LINES

< > BotCompany Repo | #1002527 // loadBinaryFromZip

JavaX fragment (include)

1  
static byte[] loadBinaryFromZip(File inZip, S fileName) ctex {
2  
  ZipFile zip = new ZipFile(inZip);
3  
  try {
4  
    ZipEntry entry = zip.getEntry(fileName);
5  
    if (entry == null)
6  
      //fail("Entry " + fileName + " not found in zip file: " + inZip.getAbsolutePath());
7  
      ret null;
8  
      
9  
    InputStream fin = zip.getInputStream(entry);
10  
    new ByteArrayOutputStream baos;
11  
    copyStream(fin, baos);
12  
    fin.close();
13  
    ret baos.toByteArray();
14  
  } finally {
15  
    zip.close();
16  
  }
17  
}

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: #1002527
Snippet name: loadBinaryFromZip
Eternal ID of this version: #1002527/1
Text MD5: adc16ae75c2074071edcb0d59fd356ac
Author: stefan
Category:
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-01-31 02:24:34
Source code size: 497 bytes / 17 lines
Pitched / IR pitched: No / No
Views / Downloads: 662 / 638
Referenced in: [show references]