Java-替代ByteArrayBuffer 解决missing in SDK23的问题
来源:互联网 发布:淘宝卷皮折扣 编辑:程序博客网 时间:2024/06/01 09:34
转载链接:http://blog.csdn.net/elonlink/article/details/52059064
问题:当SDK升级到23时候提示不存在org.apache.http.util.ByteArrayBuffer
1、使用ByteArraybuffer的代码
BufferedInputStream bis = new BufferedInputStream(is); ByteArrayBuffer baf = new ByteArrayBuffer(50); while ((current = bis.read()) != -1) { baf.append((byte) current); } FileOutputStream fos = new FileOutputStream(file); fos.write(buffer.toByteArray());
2、使用ByteArrayOutputStream替代的代码
BufferedInputStream bis = new BufferedInputStream(is); ByteArrayOutputStream buffer = new ByteArrayOutputStream(); //We create an array of bytes byte[] data = new byte[50]; int current = 0; while((current = bis.read(data,0,data.length)) != -1){ buffer.write(data,0,current); } FileOutputStream fos = new FileOutputStream(file); fos.write(buffer.toByteArray()); fos.close();
0 0
- Java-替代ByteArrayBuffer 解决missing in SDK23的问题
- 替代ByteArrayBuffer 解决missing in SDK23的问题
- 替代 ByteArrayBuffer 解决 missing in SDK23 的问题
- 解决在SDK23环境下android:singleLine="true"的singleLine失效过期问题
- 【Leetcode】:268. Missing Number 问题 in JAVA
- 对于 出现Missing parentheses in call to ‘print’和’raw_input’ is not defined问题的解决
- sdk23后HttpClient无法使用的解决方式
- 问题:missing } in XML expression的解决方法
- "missing separator. Stop"问题的解决
- xcode 工程 sdk missing 问题的解决
- "Base SDK Missing"问题的解决
- iBatis动态Sql解决In子句的替代方法
- Swift - missing required architecture i386 in file错误的解决
- 解决VS2102中fopen替代为fopen_s的问题
- 六个可以替代传统事务解决并发问题的建议
- Exception in thread "main" java.lang.NoClassDefFoundError问题的解决
- Xcode8 如何解决 Missing file 报“xxx”is missing from working copy 警告的的问题
- Document root element is missing.问题的解决
- thread_preempt
- 华为解锁刷机root教程详解
- 剑指-栈的压入和弹出序列
- HDU 1686 Oulipo
- QQ邮箱发送失败: 命令顺序不正确 Error: need EHLO and AUTH first
- Java-替代ByteArrayBuffer 解决missing in SDK23的问题
- leetcode_c++:树:Binary Tree Level Order Traversal II(107)
- response.setHeader()的用法
- QTableWidget实战
- 使用纯前端JavaScript 实现Excel IO
- Erlang 之 Mnesia error
- RecyclerView &ListView
- Bluedroid GKI源码分析
- 虚拟桌面现状