import java.io.ioexception;import java.io.inputstream;import java.util.properties;import org.apache.log4j.logger;/** * propertiesutil * * @author yangshenhui */public class propertiesutil { private static logger logger = Logger.getlogger (Propertiesutil.class); private propertiesutil () { } private Static class singletonholder { private final static propertiesutil instance = new propertiesutil (); } public static propertiesutil getinstance () { return SingletonHolder.INSTANCE; } public Properties GetProperties (String filename) { Properties Properties = new Properties (); inputstream inputstream = null; try { inputstream = prOpertiesUtil.class.getClassLoader () .getresourceasstream (fileName); properties.load (InputStream); } catch (ioexception e) { Logger.error (E.getmessage (), e); } finally { if (inputStream != null) { try { inputstream.close (); } catch (ioexception e) { Logger.error (E.getmessage (), e); } } } return properties; }}
Java Learning Data-java Optimal single case model