Java读取配置文件
try {
InputStream in = new BufferedInputStream(new FileInputStream("key.properties"));
props.load(in);
for (String it : props.stringPropertyNames()){
switch (it){
case "authkey":this.authkeyAndSecret.setAuthkey(props.getProperty(it));
System.out.println("read anthkey.");
break;
case "secret":this.authkeyAndSecret.setSecret(props.getProperty(it));
System.out.println("read secret.");
break;
case "NodeTreeUrl":this.authkeyAndSecret.setNodeTreeUrl(props.getProperty(it));
System.out.println("read secret.");
break;
}
}
in.close();
}catch (Exception e) {
System.out.println(e);
}
本文标题:Java读取配置文件
本文链接:https://www.haomeiwen.com/subject/drdggttx.html
网友评论