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

24
LINES

< > BotCompany Repo | #1008548 // loadBinaryPageSilently

JavaX fragment (include)

static byte[] loadBinaryPageSilently(String url) ctex {
  return loadBinaryPageSilently(openConnection(new URL(url)));
}

static byte[] loadBinaryPageSilently(URLConnection con) ctex {
  setHeaders(con);
  ret loadBinaryPageSilently_noHeaders(con);
}

static byte[] loadBinaryPageSilently_noHeaders(URLConnection con) ctex {
  new ByteArrayOutputStream buf;
  InputStream inputStream = con.getInputStream();
  long len = 0;
  try { len = con.getContentLength/*Long*/(); } catch (Throwable e) { printStackTrace(e); }
  int n = 0;
  while (true) {
    int ch = inputStream.read();
    if (ch < 0)
      break;
    buf.write(ch);
  }
  inputStream.close();
  ret buf.toByteArray();
}

Author comment

Began life as a copy of #1000837

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1008548
Snippet name: loadBinaryPageSilently
Eternal ID of this version: #1008548/4
Text MD5: f81679db0e83f4da7228c2923e31e8d0
Author: stefan
Category:
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-05-04 17:35:16
Source code size: 705 bytes / 24 lines
Pitched / IR pitched: No / No
Views / Downloads: 396 / 432
Version history: 3 change(s)
Referenced in: [show references]