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

19
LINES

< > BotCompany Repo | #1004697 // streamToBytes

JavaX fragment (include)

static byte[] streamToBytes(InputStream in) ctex {
  try {
    new ByteArrayOutputStream baos;
    copyStream(in, baos);
    ret baos.toByteArray();
  } finally {
    in.close();
  }
}

static byte[] streamToBytes(InputStream in, int expectedSize) ctex {
  try {
    ByteArrayOutputStream baos = new ByteArrayOutputStream(expectedSize);
    copyStream(in, baos);
    ret baos.toByteArray();
  } finally {
    in.close();
  }
}

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: 592 / 658
Version history: 1 change(s)
Referenced in: [show references]