⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 environmentconfig.java

📁 动态网站管理发布系统
💻 JAVA
字号:
package com.ntsky.common;

import java.io.FileInputStream;
import java.io.InputStream;
import java.util.Hashtable;
import java.util.Properties;

public class EnvironmentConfig
{

    static EnvironmentConfig ec;
    private static Hashtable register = new Hashtable();
    static Class class$com$ntsky$common$EnvironmentConfig; 

    private EnvironmentConfig()
    {
    }

    public static EnvironmentConfig getInstance()
    {
        if(ec == null)
            ec = new EnvironmentConfig();
        return ec;
    }

    public Properties getProperties(String fileName)
    {
        InputStream is = null;
        Properties p = null;
        try
        {
            p = (Properties)register.get(fileName);
            if(p == null)
            {
                try
                {
                    is = new FileInputStream(fileName);
                }
                catch(Exception e)
                {
                    if(fileName.startsWith("/"))
                        is = (class$com$ntsky$common$EnvironmentConfig != null ? class$com$ntsky$common$EnvironmentConfig : (class$com$ntsky$common$EnvironmentConfig = class$("com.ntsky.common.EnvironmentConfig"))).getResourceAsStream(fileName);
                    else
                        is = (class$com$ntsky$common$EnvironmentConfig != null ? class$com$ntsky$common$EnvironmentConfig : (class$com$ntsky$common$EnvironmentConfig = class$("com.ntsky.common.EnvironmentConfig"))).getResourceAsStream("/" + fileName);
                }
                p = new Properties();
                p.load(is);
                register.put(fileName, p);
                is.close();
            }
        }
        catch(Exception e)
        {
            e.printStackTrace(System.out);
        }
        return p;
    }

    public String getPropertyValue(String fileName, String strKey)
    {
        try{
        Properties p = getProperties(fileName);
        return (String)p.get(strKey);
        }catch(Exception e){
          e.printStackTrace(System.out);
          return null;
        }
        
    }

    static Class class$(String x0)
    {
    	try{
    		return Class.forName(x0);	
    	}catch(ClassNotFoundException x1){
    		throw new NoClassDefFoundError(x1.getMessage());
    	}       
    }

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -