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

17
LINES

< > BotCompany Repo | #1002527 // loadBinaryFromZip

JavaX fragment (include)

static byte[] loadBinaryFromZip(File inZip, S fileName) ctex {
  ZipFile zip = new ZipFile(inZip);
  try {
    ZipEntry entry = zip.getEntry(fileName);
    if (entry == null)
      //fail("Entry " + fileName + " not found in zip file: " + inZip.getAbsolutePath());
      ret null;
      
    InputStream fin = zip.getInputStream(entry);
    new ByteArrayOutputStream baos;
    copyStream(fin, baos);
    fin.close();
    ret baos.toByteArray();
  } finally {
    zip.close();
  }
}

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: 663 / 638
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1009761 - zipInputStream
#1022643 - loadBinaryFileFromZipInZip [dev.]
#3000382 - Answer for ferdie (>> t = 1, f = 0)