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

19
LINES

< > BotCompany Repo | #1004697 // streamToBytes

JavaX fragment (include)

1  
static byte[] streamToBytes(InputStream in) ctex {
2  
  try {
3  
    new ByteArrayOutputStream baos;
4  
    copyStream(in, baos);
5  
    ret baos.toByteArray();
6  
  } finally {
7  
    in.close();
8  
  }
9  
}
10  
11  
static byte[] streamToBytes(InputStream in, int expectedSize) ctex {
12  
  try {
13  
    ByteArrayOutputStream baos = new ByteArrayOutputStream(expectedSize);
14  
    copyStream(in, baos);
15  
    ret baos.toByteArray();
16  
  } finally {
17  
    in.close();
18  
  }
19  
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1004697
Snippet name: streamToBytes
Eternal ID of this version: #1004697/2
Text MD5: d9572eca6c4c19891c681968b949c73c
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-04-20 15:14:08
Source code size: 444 bytes / 19 lines
Pitched / IR pitched: No / No
Views / Downloads: 594 / 660
Version history: 1 change(s)
Referenced in: [show references]