-----------------------解析属性文件-----------------------------
/** * 获取src下属性文件 * @param params * @return */
public static Map<String, String> lhGetFileVersion(Map<String, String>params){
String verCode=null;
String newversion=null;
Map<String, String> map=new HashMap<String, String>();
InputStream in=null;
Properties properties = new Properties();
try {
in=PublicFunctionUtil.class.getClass().getResourceAsStream(params.get("FileUrl").toString());//属性文件路径
if(in!=null||!"null".equals(in)){
in=Thread.currentThread().getContextClassLoader().getResourceAsStream(params.get("FileName").toString());//属性文件名
properties.load(in);
verCode=properties.getProperty(params.get("FileKey").toString());//属性文件的key值
}
in.close();
map.put("newproduct", verCode);
} catch (Exception e) {
e.printStackTrace();
return null;
}
return map;
}
}