-----------------------解析属性文件-----------------------------

/**   * 获取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;  

 }

}

相关文章:

  • 2022-12-23
  • 2021-11-17
  • 2021-10-15
  • 2022-12-23
  • 2022-12-23
  • 2021-09-10
  • 2021-10-04
猜你喜欢
  • 2022-12-23
  • 2022-02-15
  • 2021-09-22
  • 2021-05-25
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案