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

18
LINES

< > BotCompany Repo | #1002031 // loadTextFileFromZipFile

JavaX fragment (include)

static S loadTextFileFromZipFile(File inZip, S fileName) ctex {
  if (!fileExists(inZip)) null;
  try {
    temp ZipFile zip = new ZipFile(inZip);
    ret loadTextFileFromZipFile(zip, fileName);
  } catch e {
    fail(f2s(inZip), e);
  }
}
    
static S loadTextFileFromZipFile(ZipFile zip, S fileName) ctex {
  ZipEntry entry = zip.getEntry(fileName);
  if (entry == null) ret null;
  temp InputStream fin = zip.getInputStream(entry);
  new ByteArrayOutputStream baos;
  copyStream(fin, baos);
  ret fromUTF8(baos.toByteArray());
}

download  show line numbers  debug dex  old transpilations   

Travelled to 17 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, sawdedvomwva, tslmcundralx, tvejysmllsmz, vouqrxazstgt, xprdwmaupziu

No comments. add comment

Snippet ID: #1002031
Snippet name: loadTextFileFromZipFile
Eternal ID of this version: #1002031/6
Text MD5: 42bf6a79649c787bd16eff78de11764d
Author: stefan
Category: javax / i.o.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-11-09 20:31:51
Source code size: 549 bytes / 18 lines
Pitched / IR pitched: No / No
Views / Downloads: 744 / 2686
Version history: 5 change(s)
Referenced in: #1002104 - loadTextFileFromZip
#1002427 - Accellerating 629 (SPIKE)
#1002527 - loadBinaryFromZip
#1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1012228 - extractFileFromZipFile
#3000382 - Answer for ferdie (>> t = 1, f = 0)