保存到配置文件
為什么80%的碼農(nóng)都做不了架構(gòu)師?>>> ??
/**
* 保存查詢京東訂單的開始時(shí)間與結(jié)束時(shí)間
*
* @param startDate
* @param endTime
* @return
* @throws IOException
*/
public void saveDate(String startDate, String endTime) {
Properties pro = new Properties();
String propertiesName = "jdStoreSearchDate.properties";
String TMP_DIR = this.getClass().getClassLoader().getResource("/").getPath();
String fileUrl = TMP_DIR + propertiesName;
//重新寫入配置文件
FileOutputStream file = null;
try {
file = new FileOutputStream(fileUrl);
pro.put("startDate", startDate);//開始時(shí)間
pro.put("endTime", endTime);//開始時(shí)間
pro.store(file, "系統(tǒng)配置修改");
file.getFD().sync();
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
file.close();
} catch (IOException e1) {
e1.printStackTrace();
}
}
System.out.println("保存開始時(shí)間和結(jié)束時(shí)間成功");
}
轉(zhuǎn)載于:https://my.oschina.net/monroe/blog/1586747
總結(jié)
- 上一篇: CSS实现斜角标签
- 下一篇: 亲情去世了安慰的句子 安慰失去亲人的暖心