InputStream流转字节数组

  //将流(inputs)转成字节数组
            ByteArrayOutputStream outStream = new ByteArrayOutputStream();
            byte[] buff = new byte[100]; //buff用于存放循环读取的临时数据
            int rc = 0;
            while ((rc = inputIs.read(buff, 0, 100)) > 0) {
                outStream.write(buff, 0, rc);
            }
            //合并之后的字节数组
            byte[] in_merge = outStream.toByteArray();

  

posted @ 2017-08-23 16:05  令狐る侠  阅读(1649)  评论(0编辑  收藏  举报