`
pingshizhe
  • 浏览: 5330 次
最近访客 更多访客>>
社区版块
存档分类
最新评论

用Properties类读取配置文件

阅读更多
    public static String getPropertyValue(String resource, String name) {
        if (resource == null || resource.length() <= 0) return "";
        if (name == null || name.length() <= 0) return "";

        Properties properties = getProperties(resource);
        if (properties == null) {
            return "";
        }

        String value = null;

        try {
            value = properties.getProperty(name);
        } catch (Exception e) {
            Debug.log(e, module);
        }
        return value == null ? "" : value.trim();
    }
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics