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

12
LINES

< > BotCompany Repo | #1031083 // loadDeflatedTextFile

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

Libraryless. Click here for Pure Java version (3005L/18K).

sS loadDeflatedTextFile(File file) ctex {
  if (!file.isFile()) ret null;
  ping();
  new ByteArrayOutputStream baos;
  temp InputStream fis = new FileInputStream(file);
  InflaterInputStream_relaxed gis = new(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
}

Author comment

Began life as a copy of #1005538

download  show line numbers  debug dex  old transpilations   

Travelled to 5 computer(s): bhatertpkbcr, ekrmjmnbrukm, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt

No comments. add comment

Snippet ID: #1031083
Snippet name: loadDeflatedTextFile
Eternal ID of this version: #1031083/3
Text MD5: fa9d435bc1d10bf86c43dd09ea5e70ff
Transpilation MD5: d9e5211fac3d703f4eb29720478c01e2
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-04-30 23:43:57
Source code size: 419 bytes / 12 lines
Pitched / IR pitched: No / No
Views / Downloads: 97 / 146
Version history: 2 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)