Properties 读取工具类

来源:互联网 发布:虚无世界2java路径 编辑:程序博客网 时间:2024/05/22 05:19
package com.xxx.patchgen.utils;import java.io.File;import java.io.FileInputStream;import java.io.IOException;import java.io.InputStream;import java.util.Properties;/** *@Description: 属性文件读取 */public final class PropertiesUtil {public static Properties loadProperties(File f) throws Exception{Properties props =  new Properties();InputStream is = new FileInputStream(f);try {if(is != null)props.load(is);} catch (IOException e) {throw new Exception("Failed to load properties file \""+ f.getAbsolutePath() +"\"", e);} finally {try {if(is != null)is.close();} catch (IOException e) {}}return props;}}

0 0
原创粉丝点击