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

📄 configparser.java

📁 华为模拟网关源码 华为模拟网关源码 华为模拟网关源码
💻 JAVA
字号:
package open_cmpp.util;

import org.xml.sax.Attributes;
import org.xml.sax.helpers.DefaultHandler;
import org.xml.sax.SAXException;
import java.util.Properties;

/**
 * ConfigParser
 *
 * @author RaymondXiu
 * @version 1.0, 2006-6-24
 * @see
 */
public class ConfigParser extends DefaultHandler {

    private Properties props;

    private String currentSet;
    private String currentName;
    private StringBuffer currentValue = new StringBuffer();

    public ConfigParser() {
        this.props = new Properties();
    }

    public Properties getProps() {
        return this.props;
    }

    public void startElement(String uri, String localName, String qName,
            Attributes attributes) throws SAXException {
        currentValue.delete(0, currentValue.length());
        this.currentName = qName;
    }

    public void characters(char[] ch, int start, int length)
            throws SAXException {
        currentValue.append(ch, start, length);
    }

    public void endElement(String uri, String localName, String qName)
            throws SAXException {
        props.put(qName.toLowerCase(), currentValue.toString().trim());
    }

}

⌨️ 快捷键说明

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