Shop/src/util/PropertiesUtil.java

(开头部分) 2KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

package util;

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

public class PropertiesUtil
{

    private static Hashtable hash = new Hashtable();
    private static final String FILENAME = "upload.properties";

    private PropertiesUtil()
    {
    }

    private Properties getProperties(String fileName)
    {
        InputStream input = null;
        Properties prop = null;
        try
        {
            prop = (Properties)hash.get(fileName);
            if(prop == null)
            {
                try
                {
                    input = new FileInputStream(fileName);
                }
                catch(Exception ex)
                {
                    if(fileName.startsWith("/"))
                    {
                    	input = getClass().getResourceAsStream(fileName);
                    } else
                    {
                        input = getClass().getResourceAsStream((new StringBuilder("/")).append(fileName).toString());
                    }
                }
                prop = new Properties();
                prop.load(input);
                if(input != null)
                {
                    input.close();
                }
            }
        }
        catch(Exception e)
        {
            return null;
        }
        return prop;
    }

    public String getProperty(String key)
    {
    	try{
        Properties prop = getProperties("upload.properties");
        if(prop == null)
后面还有 51 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。