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

13
LINES

< > BotCompany Repo | #2000463 // loadBinaryPage

New Tinybrain snippet

1  
  public static byte[] loadBinaryPage(URLConnection con) throws IOException {
2  
    //setHeaders(con);
3  
    ByteArrayOutputStream buf = new ByteArrayOutputStream();
4  
    InputStream inputStream = con.getInputStream();
5  
    while (true) {
6  
      int ch = inputStream.read();
7  
      if (ch < 0)
8  
        break;
9  
      buf.write(ch);
10  
    }
11  
    inputStream.close();
12  
    return buf.toByteArray();
13  
  }

download  show line numbers   

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: 516 / 129
Referenced in: [show references]