InputStream转byte @param input 输入流 @return @throws IOException
(InputStream input)
| 52 | * @throws IOException |
| 53 | */ |
| 54 | public static byte[] inputStreamToByteArray(InputStream input) |
| 55 | throws IOException{ |
| 56 | ByteArrayOutputStream output = new ByteArrayOutputStream(); |
| 57 | copy(input, output); |
| 58 | return output.toByteArray(); |
| 59 | } |
| 60 | private static int copy(InputStream input, OutputStream output)throws IOException{ |
| 61 | byte[] buffer = new byte[4096]; |
| 62 | long count = 0L; |