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

19
LINES

< > BotCompany Repo | #1008630 // gzippedSize - gzipped byte size of a UTF-8 string, byte array or file

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

Libraryless. Click here for Pure Java version (179L/2K).

static long gzippedSize(byte[] data) ctex {
  new JustCountingOutputStream jcos;
  GZIPOutputStream gos = new GZIPOutputStream(jcos);
  gos.write(data, 0, l(data));
  gos.close();
  ret jcos!;
}

static int gzippedSize(S s) {
  ret l(gzipString(s));
}

static long gzippedSize(File f) ctex {
  new JustCountingOutputStream jcos;
  var gos = new GZIPOutputStream(jcos);
  file2stream(f, gos);
  gos.close();
  ret jcos!;
}

Author comment

Began life as a copy of #1006276

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1008630
Snippet name: gzippedSize - gzipped byte size of a UTF-8 string, byte array or file
Eternal ID of this version: #1008630/4
Text MD5: 9a902b3230f7b4fe4abd7a072fa5e272
Transpilation MD5: 5004fff0e58f4f84e6680aed877e4bbb
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-06-27 03:15:02
Source code size: 439 bytes / 19 lines
Pitched / IR pitched: No / No
Views / Downloads: 484 / 538
Version history: 3 change(s)
Referenced in: [show references]