FileInputStream FileOutputStream
来源:互联网 发布:4glte网络优化前景如何 编辑:程序博客网 时间:2024/05/18 03:07
String path=context.getFilesDir().getPath();//应用的路径//String sdpathString=Environment.getExternalStorageDirectory().getPath();//sd卡的路径
写数据
String result=username+"##"+password;String path=context.getFilesDir().getPath();//应用的路径//String sdpathString=Environment.getExternalStorageDirectory().getPath();//sd卡的路径///mnt/sdcard/info.txt 往sd卡存数据要加权限File file=new File(path,"info.txt");//创建输出流FileOutputStream fos;fos = new FileOutputStream(file);fos.write(result.getBytes());fos.close();
读取数据:
String path=context.getFilesDir().getPath(); File file = new File(path,"info.txt"); FileInputStream fiStream; Map<String, String> maps=new HashMap<>();//用来保存用户名和密码 fiStream = new FileInputStream(file); BufferedReader bfReader=new BufferedReader(new InputStreamReader(fiStream)); String resule=bfReader.readLine(); //切割 String[] splits=resule.split("##"); String name=splits[0]; String pwdString=splits[1]; //存到map中 maps.put("name",name); maps.put("pwd", pwdString); bfReader.close();//关流
0 0
- FileInputStream&&FileOutputStream
- FileOutputStream/FileInputStream
- FileInputStream/FileOutputStream
- FileOutputStream&FileInputStream
- FileInputStream FileOutputStream
- FileInputStream||FileOutputStream
- FileInputStream and FileOutputStream
- FileInputStream和FileOutputStream
- IO:FileInputStream和FileOutputStream
- Java - FileOutputStream and FileInputStream
- FileInputStream与FileOutputStream类
- FileInputStream/FileOutputStream的应用
- FileOutputStream,FileInputStream简单操作
- FileInputStream/FileOutputStream的应用
- FileInputStream/FileOutputStream的应用
- FileInputStream和FileOutputStream类
- FileInputStream/FileOutputStream的应用
- FileInputStream/FileOutputStream的应用
- 5.6.3 投影和均匀裁剪空间
- linux 网络配置不生效ifconfig只看到环回口lo问题
- 解决百度地图找不到SDKInitializer,无法解析的问题
- MySQL重要但容易被忽略_MySQL自定义函数&存储过程
- 信号驱动式I/O模型,以终端I/O为例写个demo
- FileInputStream FileOutputStream
- 出发吧
- mysql约束
- android文件
- Android实现微信录制小视频的计时动画
- 网络爬虫:利用Selenium实现登录
- mysql 多表 查询
- 仿支付宝支付成功动画
- 最长上升子序列