源代码1: InputStream in = new FileInputStream("E:\\java编程思想.jpg"); byte[] data = new byte[in.available()]; in.read(data);源代码2: InputStream in = new FileInputStream("E:\\java编程思想.jpg"); ByteArrayOutputStream output = new ByteArrayOutputStream(); byte[] data = null; byte[] buf = new byte[1024]; int numBytesRead = 0; while ((numBytesRead = in.read(buf)) != -1) { output.write(buf, 0, numBytesRead); } data = output.toByteArray();以上两个程序有什么性能上的区别吗?
- 3 回答
- 0 关注
- 554 浏览
添加回答
举报
0/150
提交
取消