1 | static S loadTextFileFromZipFile(File inZip, S fileName) ctex { |
2 | if (!fileExists(inZip)) null; |
3 | try { |
4 | temp ZipFile zip = new ZipFile(inZip); |
5 | ret loadTextFileFromZipFile(zip, fileName); |
6 | } catch e { |
7 | fail(f2s(inZip), e); |
8 | } |
9 | } |
10 | |
11 | static S loadTextFileFromZipFile(ZipFile zip, S fileName) ctex { |
12 | ZipEntry entry = zip.getEntry(fileName); |
13 | if (entry == null) ret null; |
14 | temp InputStream fin = zip.getInputStream(entry); |
15 | new ByteArrayOutputStream baos; |
16 | copyStream(fin, baos); |
17 | ret fromUTF8(baos.toByteArray()); |
18 | } |
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: | 645 / 2588 |
Version history: | 5 change(s) |
Referenced in: | [show references] |