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

12
LINES

< > BotCompany Repo | #1031089 // loadGZTextFile_relaxed - accept incomplete files

JavaX fragment (include)

sS loadGZTextFile_relaxed(File file) ctex {
  if (!file.isFile()) ret null;
  ping();
  new ByteArrayOutputStream baos;
  temp InputStream fis = new FileInputStream(file);
  GZIPInputStream_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 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt

No comments. add comment

Snippet ID: #1031089
Snippet name: loadGZTextFile_relaxed - accept incomplete files
Eternal ID of this version: #1031089/1
Text MD5: e41ed7b595a628ebbf1202ccfdfcaa7f
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-05-01 00:20:38
Source code size: 417 bytes / 12 lines
Pitched / IR pitched: No / No
Views / Downloads: 147 / 198
Referenced in: [show references]