节点读写

2018-05-16  本文已影响16人  Justin_YXZ
/**
* 获取节点
*/
public static String getPointInfo(String path) {
    String prop =null;// 默认值
    String result ="";
    try {
        BufferedReader reader =new BufferedReader(new FileReader(path));
        while ((prop = reader.readLine()) !=null) {
            result = prop;
        }
    }catch (IOException e) {
        e.printStackTrace();
    }
    return result;
}

/**
* 写节点
*
* @param point
* @param value
*/
public static void setPoint(String point, int value) {
    try {
        FileWriter fw =new FileWriter(point);
        fw.write('0' + value);
        fw.flush();
        fw.close();
    }catch (Exception e) {
        e.printStackTrace();
    }
}
上一篇 下一篇

猜你喜欢

热点阅读