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).

1  
sS loadDeflatedTextFile(File file) ctex {
2  
  if (!file.isFile()) ret null;
3  
  ping();
4  
  new ByteArrayOutputStream baos;
5  
  temp InputStream fis = new FileInputStream(file);
6  
  InflaterInputStream_relaxed gis = new(fis);
7  
  byte[] buffer = new byte[1024];
8  
  int len;
9  
  while ((len = gis.read(buffer)) != -1) baos.write(buffer, 0, len);
10  
  baos.close();
11  
  return fromUtf8(baos.toByteArray()); // TODO: use a Reader
12  
}

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: 168 / 247
Version history: 2 change(s)
Referenced in: [show references]