替代ByteArrayBuffer 解决missing in SDK23的问题
来源:互联网 发布:首次提出大数据的时间 编辑:程序博客网 时间:2024/06/01 08:35
问题:当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问题的解决
- winrar5.31 专用激活key
- oscache缓存配置
- 16.7.12
- WLAN的一些术语
- java学习笔记1
- 替代ByteArrayBuffer 解决missing in SDK23的问题
- 6种单例模式实现
- 22.Generate Parentheses
- viewPaper+Fragment的布局,在初始化时会导致fragment的布局加载和网络请求数据(懒加载)
- 仿QQ5.0侧滑先行版
- 文字上下轮播
- Android的多分辨率适配的处理
- Iterator<Entry<String, HashMap<String, String>>>
- 如何测试Azure虚拟机网络连通性(默认禁Ping)