文件名称:读取Properties文件的java类
文件大小:1KB
文件格式:JAVA
更新时间:2013-12-15 04:27:37
Properties
package cn.cucsi.ccs; import java.io.IOException; import java.io.InputStream; import java.util.Properties; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public class ReadProperties { private static final Log log = LogFactory.getLog(ReadProperties.class); /** * 璇诲彇璧勬簮鏂囦欢 * @param strFilePath 鏂囦欢璺緞 * @Author 锛歡aochao */ public static Properties getPropertiesObj(String strFilePath) { Properties proRe = null; InputStream is; proRe = new Properties(); is = ReadProperties.class.getClassLoader().getResourceAsStream( strFilePath); if (is == null) { WriteLog.writeLog("閰嶇疆鏂囦欢涓嶅瓨鍦紝璇锋鏌ユ枃浠跺悕鎴栬矾寰勬槸鍚︽纭紒"); return null; } try { proRe.load(is); } catch (IOException e) { // TODO Auto-generated catch block WriteLog.writeLog("閰嶇疆鏂囦欢鍔犺浇澶辫触锛岃妫€鏌ユ枃浠跺悕鎴栬矾寰勬槸鍚︽纭紒"); return null; } try { is.close(); } catch (IOException e) { // TODO Auto-generated catch block WriteLog.writeLog("閰嶇疆鏂囦欢鏂囦欢娴佸叧闂け璐ワ紒"); return null; } return proRe; } }