替代 ByteArrayBuffer 解决 missing in SDK23 的问题
来源:互联网 发布:淘宝和亚马逊swot分析 编辑:程序博客网 时间:2024/05/22 03:08
问题:当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
- 替代ByteArrayBuffer 解决missing in SDK23的问题
- 替代 ByteArrayBuffer 解决 missing in SDK23 的问题
- Java-替代ByteArrayBuffer 解决missing in SDK23的问题
- 解决在SDK23环境下android:singleLine="true"的singleLine失效过期问题
- 对于 出现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的问题
- 六个可以替代传统事务解决并发问题的建议
- Xcode8 如何解决 Missing file 报“xxx”is missing from working copy 警告的的问题
- Document root element is missing.问题的解决
- eclipse中is missing required source folder问题的解决
- win8激活及bootMGR is missing问题的解决
- IOS Dev Intro - NM OTool lipo
- 【LeetCode】 006. ZigZag Conversion
- RBAC
- 华为在线训练(4)
- 单词语音音标正则式查询分析JavaScript应用
- 替代 ByteArrayBuffer 解决 missing in SDK23 的问题
- Python(切片)
- Android插件技术(一) JVM 类加载机制
- Tempter of the Bone hd 1010 (剪枝)
- Sqlite 存储自定义对象
- cocos2dx3.0 打飞机完整项目
- 指针的用法
- HBase集群搭建
- 【LeetCode】 007. Reverse Integer