读书人

用Properties种读取配置文件

发布时间: 2012-08-29 08:40:14 作者: rapoo

用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();
}

读书人网 >编程

热点推荐