Properties props = new Properties();
InputStream fis = new FileInputStream("MsgConfig.properties");
//从输入流中读取属性列表(键和元素对)
props.load(fis);
fis.close();//一定要在修改值之前关闭fis
OutputStream fos = new FileOutputStream("MsgConfig.properties");
props.setProperty("ismgIp",form.getConfig().getIsmgIp() );
props.store(fos, "Update '" + "ismgIp" + "' value");
props.setProperty("sharedSecret",form.getConfig().getSharedSecret() );
props.store(fos, "Update '" + "sharedSecret" + "' value");
props.setProperty("spId",form.getConfig().getSpId() );
props.store(fos, "Update '" + "spId" + "' value");
props.setProperty("ismgPort", form.getConfig().getIsmgPort());
props.store(fos, "Update '" + "ismgPort" + "' value");
props.setProperty("spCode", form.getConfig().getSpCode());
props.store(fos, "Update '" + "spCode" + "' value");
props.setProperty("timeOut", form.getConfig().getTimeOut());
props.store(fos, "Update '" + "timeOut" + "' value");
props.setProperty("connectCount",form.getConfig().getConnectCount() );
props.store(fos, "Update '" + "connectCount" + "' value");
fos.close();
直接输出是修改了,但是配置文件里面的内容又没改过来
呼唤远方
芜湖不芜