网络获取数据sd卡读取
来源:互联网 发布:c语言编译环境 编辑:程序博客网 时间:2024/05/17 22:03
//写入
File file = new File(Environment.getExternalStorageDirectory().getPath() + "/city.txt"); if (file.exists()) { try { FileInputStream stream = new FileInputStream(file); ByteArrayOutputStream bos = new ByteArrayOutputStream(); int len; byte[] b = new byte[1024]; while ((len = stream.read(b)) != -1) { bos.write(b, 0, len); } bos.close(); stream.close(); String s = bos.toString(); getData(s); } catch (Exception e) { e.printStackTrace(); } }else{ //获取网络数据 getServerData(); }}
//读取
File file= Environment.getExternalStorageDirectory();File file1=new File(file.getPath()+"/city.txt");PrintWriter pw=null;if (!file1.exists()){ try { file1.createNewFile(); } catch (IOException e) { e.printStackTrace(); }}try { pw=new PrintWriter(new FileOutputStream(file1)); pw.write(s); pw.close();} catch (FileNotFoundException e) { e.printStackTrace();}getData(s);
0 0
- 网络获取数据sd卡读取
- 获取SD卡容量和读取数据和访问权限
- Android---数据读取、存储、删除(内存储/SD卡存储/网络数据读取存储)
- Android读取SD卡数据
- SD卡存储读取数据
- Android数据存储:获取网络图片把图片保存到SD卡中并从SDk卡中读取(通过Bitmap方法)
- Android手机数据读写方法(内部存储、SD卡,网络加载,包内文件读取)
- 单片机读取SD卡数据解决方案
- Android使用sd卡保存读取数据
- Android获取sd卡空间数据
- SD在fat16读取数据
- uiautomator 2.0 android 6.0读取SD卡权限获取
- 基于ATmega32的SD卡上FAT32文件系统数据读取
- Android应用程序对SD卡数据的写入和读取
- android读取写入SD卡文件夹和SharedPreferences数据
- Android 如何从SD卡中读取数据?
- Android sd卡读取
- Android SD卡读取
- Leetcode刷题(4)
- RecycleView的实现
- [LeetCode]Find Right Interval(Java)
- 入手树莓派
- CodeForces 780B The Meeting Place Cannot Be Changed【二分】
- 网络获取数据sd卡读取
- 密码学之凯撒加密解密算法
- 使用 ffmpeg 进行网络推流:拉流->解封装->解码->处理原始数据(音频、视频)->编码->编码->推流
- Linux apache下导入SSL证书
- 《剑指offer》数组——二维数组中查找
- 如何使用Androidstudio实现中英手机信息页面
- 快速排序
- hdu 1014
- Fragment详解之六——如何监听fragment中的回退事件与怎样保存fragment状态