Android 文件读写到命名空间的文件夹(简单)
来源:互联网 发布:linux 没有tmp文件夹 编辑:程序博客网 时间:2024/06/08 16:58
文件保存到命名空间的files文件夹里
FileOutputStream fileOutputStream ;try {fileOutputStream = getApplicationContext().openFileOutput(filename, MODE_WORLD_READABLE + MODE_WORLD_WRITEABLE);fileOutputStream.write(filecontent.getBytes());fileOutputStream.close(); } catch (Exception e) {<span style="white-space:pre"></span>// TODO Auto-generated catch block<span style="white-space:pre"></span>e.printStackTrace();<span style="white-space:pre"></span>}
从命名空间里的files文件夹里读取文件
String path = getApplicationContext().getFilesDir().getAbsolutePath();filename = name.getText().toString();path = path +"/" +filename;File file = new File(path);FileInputStream fileInputStream;try {fileInputStream = new FileInputStream(file);byte[] buffer = new byte[1024];fileInputStream.read(buffer);fileInputStream.close();String neirong = new String(buffer, "utf-8"); //内容} catch (Exception e) {// TODO Auto-generated catch blocke.printStackTrace();}
0 0
- Android 文件读写到命名空间的文件夹(简单)
- Android布局文件的命名空间
- android读写assets目录下面的资源文件(文件夹)
- android读写assets目录下面的资源文件(文件夹)
- Android下私有文件夹文件的读写
- xml(带有命名空间的)读写操作
- IO流--将单级文件夹下的文件复制到目标文件夹下,并重命名所有文件
- 建立一个当前date 命名的文件夹,copy文件到此文件夹中,并记录log
- Android布局文件中命名空间的解析
- Android布局文件中命名空间的解析
- Android布局文件中命名空间的解析
- Android布局文件中命名空间的解析
- C++ 读写文件,格式化输出到文件的简单代码
- Android读写assets目录下面的资源文件(文件夹)
- Android读写assets目录下面的资源文件(文件夹)
- Android读写assets目录下面的资源文件(文件夹)
- 文件夹 文件的创建 读写
- 关于android的命名空间
- Python获取ip地址
- ECCO爱步-让行走成为一种乐趣
- Oracle时间加减
- js中身份证的正则表达式
- 你怎么对待婚姻,婚姻就怎么对待你!
- Android 文件读写到命名空间的文件夹(简单)
- 基于PHP的cURL快速入门
- GIT分支管理是一门艺术
- Spring学习1-初识Spring
- setTimeout函数以及在各个浏览器里的兼容问题
- C++虚继承
- SQL语句执行过程详解
- 使用Memory Analyzer tool(MAT)分析内存泄漏(一)
- Spring Boot框架快速构建应用