从一个文件里面读取一个txt文件
2016-01-07 17:33
429 查看
本人基础不好 ,所以还是收集下比较好,不要见笑
private String textName = "json.txt";outPath = Environment.getExternalStorageDirectory().getPath() + "/Android/data/copyzip/";
/**
* 吧json.txt读出来 读成一个String * * */ try { StringBuffer sb = new StringBuffer(); File file = new File(outPath + "/" + textName); BufferedReader br = new BufferedReader(new FileReader(file)); String line = ""; while ((line = br.readLine()) != null) { sb.append(line); } jsonText = sb.toString(); br.close(); } catch (IOException e) { e.printStackTrace(); }
相关文章推荐
- 事业单位改革
- CouchBase 2.5Kb数据无法编辑的解决办法
- Python学习笔记9-Python 链接MySql数据库
- Android项目中使用NativeLibCompression遇到的一些坑
- Retrofit入门
- Retrofit入门
- http post不使用库,上传带参数的文件时的消息体样式
- git 上传本地文件到github
- setInterval定时和ajax请求
- 牛客堂刷题之KMP
- 动态添加元素及添加事件
- GCD
- Android之Android apk动态加载机制的研究(二):资源加载和activity生命周期管理
- configure: error: Bundled APR requested but not found at ./srclib/. Download and unpack the corresponding apr and apr-util packages to ./srclib/.
- 老李分享:Robotium创建Note的实例
- Jetty如何实现NIO分析(三)
- Unity3D游戏开发Shade渲染错乱简单处理法
- Redis学习记录之简介(一)
- NSString 与 Class 互转
- http、TCP/IP协议与socket之间的区别