zoukankan      html  css  js  c++  java
  • java解析属性文件

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

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

     }

    }

  • 相关阅读:
    Python学习-day10
    python学习-day9
    Python学习-day8
    Python学习-day7
    Python学习-day6
    Django2
    Django讲解
    JQuery讲解
    前端Day2
    前端Day1
  • 原文地址:https://www.cnblogs.com/qgc88/p/Properties.html
Copyright © 2011-2022 走看看