读取和写入手机配置文件代码
来源:互联网 发布:犀牛地方门户源码官网 编辑:程序博客网 时间:2024/05/18 20:52
以String path = "/sys/misc-config/lte_radio_ant_sw1" 为例
一、读取手机配置文件
private String getAerialConfig(String path) { FileInputStream is = null; String val = null; try { is = new FileInputStream(path); byte[] buffer = new byte[64]; int count = is.read(buffer); if (count > 0) { val = new String(buffer, 0, count); } } catch (IOException e) { Log.d(TAG, "IOException: setAerialConfig " + e); } finally { if (is != null) { try { is.close(); } catch (IOException e) { } } } if (val != null) { val = val.trim(); } return val; }
二、写入配置文件
private void setAerialConfig(String path, String config) { Log.d(TAG, "setAerialConfig: " + config); FileOutputStream out = null; try { out = new FileOutputStream(path); byte[] buf = config.getBytes(); out.write(buf, 0, buf.length); } catch (FileNotFoundException e) { Log.e(TAG, "FileNotFoundException: setAerialConfig " + e); } catch (IOException e) { Log.e(TAG, "IOException: setAerialConfig " + e); } finally { try { if (out != null) out.close(); } catch (IOException e) { } } }
0 0
- 读取和写入手机配置文件代码
- 读取和写入配置文件
- 读取配置文件和写入配置文件
- properties 读取和写入配置文件
- C#读取和写入配置文件
- VC读取和写入配置文件
- 配置文件读取和写入类
- VC配置文件读取和写入
- java 读取和写入配置文件中的数据
- C++读取、写入配置文件
- C#读取和写入Excel2003的代码
- PropertiesHelper——配置文件读取和写入工具类
- MFC读取和写入INI配置文件当前目录
- C#打印系统读取和写入XML配置文件
- 解决三星手机写入和读取文件失败问题
- Properties配置文件读取/写入例子
- Java读取/写入Yaml配置文件
- C#读取与写入配置文件
- Git 基础命令操作指引
- Spring注解入门
- HTML DOM学习笔记
- linux基础知识
- 特征放大算法学习
- 读取和写入手机配置文件代码
- 1054. 求平均值 (20)
- php 枚举问题
- java主键生成
- java源码分析(2)-String(1)
- 利用测试工具Loadrunner,刷博客访问量与积分实战
- 导航页面ViewPager和欢迎界面的实现
- android listView设置了点击事件 点击无效
- codeforces round 348 div2