美文网首页
Java读取配置文件

Java读取配置文件

作者: RageYourDream_ | 来源:发表于2017-03-09 19:25 被阅读0次
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