美文网首页
Android 读写设备节点

Android 读写设备节点

作者: 冻柠猹 | 来源:发表于2019-05-03 23:17 被阅读0次

    定义节点路径:

    static final String PATH = "/productinfo/.save_capacity";
    

    写入节点:

    try{
          BufferedWriter bufWriter = null;
          bufWriter = new BufferedWriter(new FileWriter(PATH));
          bufWriter.write("输入");
          bufWriter.close();
       }catch(IOException e){
          e.printStackTrace();
       }
    

    读取节点:

    try{
         BufferedReader reader = new BufferedReader(new FileReader(PATH));
         String result = reader.readLine();
         if (result != null) {
           //写入判断逻辑
         }
       }catch(IOException e){
          e.printStackTrace();
       }
    

    相关文章

      网友评论

          本文标题:Android 读写设备节点

          本文链接:https://www.haomeiwen.com/subject/blrvwqtx.html