copyoftaskproperties.java

来自「用来为垂直搜索引擎抓取数据的采集系统」· Java 代码 · 共 63 行

JAVA
63
字号
/*
 * *****************************************************
 * Copyright (c) 2005 IIM Lab. All  Rights Reserved.
 * Created by xuehao at 2005-10-12
 * Contact: zxuehao@mail.ustc.edu.cn
 * *****************************************************
 */

package org.indigo.util;

import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.Properties;
/**
 * 利用java中Properties获取属性。
 * @author wbz
 *
 */
public class CopyOfTaskProperties
{
    private static Properties itsProps = null;
    private static HashMap itsMap = null;

    public void open( String file, String encoding )
    {
        encoding = "gb2312";
        
    }
    /**
     * 把指定的文件和属性对象关联起来。
     * @param file
     */
    public void open( String file )
    {
        InputStream is = null;
        if( itsProps==null )
        {
            is = getClass().getResourceAsStream( file );
            itsProps = new Properties();
        }
        try
        {
//            itsProps.clear();
            itsProps.load(is);
        } catch (IOException e)
        {
            e.printStackTrace();
        }
    }
/**
 * 获取指定关键字的属性值。
 * @param key
 * @return
 */
    public String getProperty(String key)
    {
        return itsProps.getProperty(key);

    }
}

⌨️ 快捷键说明

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