public static byte[] loadBinaryPage(URLConnection con) throws IOException {
//setHeaders(con);
ByteArrayOutputStream buf = new ByteArrayOutputStream();
InputStream inputStream = con.getInputStream();
while (true) {
int ch = inputStream.read();
if (ch < 0)
break;
buf.write(ch);
}
inputStream.close();
return buf.toByteArray();
}
Snippet is not live.
Travelled to 12 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #2000463 |
| Snippet name: | loadBinaryPage |
| Eternal ID of this version: | #2000463/1 |
| Text MD5: | c1a72c90a17e699643a88bef094ce7a0 |
| Author: | stefan |
| Category: | |
| Type: | New Tinybrain snippet |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2015-07-26 20:20:24 |
| Source code size: | 400 bytes / 13 lines |
| Pitched / IR pitched: | No / Yes |
| Views / Downloads: | 728 / 176 |
| Referenced in: | #2000465 - loadBinaryPage with progress monitoring on System.err #3000382 - Answer for ferdie (>> t = 1, f = 0) |