package com.lion.util;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Properties;


public class PropertiesUtil {
	public static Properties properties;
	 static
	  {
		 InputStreamReader reader = null;
	    try {
	      String classPath = PropertiesUtil.class.getClassLoader().getResource("").toURI().getPath();
	      String filePath = classPath  + "config.properties";
	      reader = new InputStreamReader(new FileInputStream(filePath),"utf-8");
	      properties = new Properties();
	      properties.load(reader);
	    } catch (Exception e) {
	      try
	      {
	        reader.close(); 
	        } catch (IOException localIOException) {
	      } 
	    }
	  }
	/**
	   * 根据Name获取Property
	   * @param name
	   * @return
	   */
	  public static String getProperty(String name) {
	    return properties.getProperty(name);
	  }
}
