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

12
LINES

< > BotCompany Repo | #1005538 // loadGZTextFile

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (2543L/16K).

sS loadGZTextFile(File file) ctex {
  if (!file.isFile()) ret null;
  ping();
  new ByteArrayOutputStream baos;
  temp InputStream fis = new FileInputStream(file);
  GZIPInputStream gis = newGZIPInputStream(fis);
  byte[] buffer = new byte[1024];
  int len;
  while ((len = gis.read(buffer)) != -1) baos.write(buffer, 0, len);
  baos.close();
  return fromUtf8(baos.toByteArray()); // TODO: use a Reader
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1005538
Snippet name: loadGZTextFile
Eternal ID of this version: #1005538/4
Text MD5: 38b1f57551400145e74997b2e9f83b1b
Transpilation MD5: 1e52c2db15d8f96c2d513ed3640d64d7
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-08-27 17:17:04
Source code size: 416 bytes / 12 lines
Pitched / IR pitched: No / No
Views / Downloads: 672 / 719
Version history: 3 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1010497 - loadGZippedTextFile - synonym of loadGZTextFile
#1031083 - loadDeflatedTextFile
#1031089 - loadGZTextFile_relaxed - accept incomplete files