定义节点路径:
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();
}