📄 configparser.java
字号:
package cmd.db;
/**
* <p>Title: </p>
*
* <p>Description: </p>
*
* <p>Copyright: Copyright (c) 2005</p>
*
* <p>Company:新太互动 </p>
*
* @author 罗永雄
* @version 1.21
*/
import java.util.Hashtable;
import java.util.Properties;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
/**
* <p>Title: </p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2002</p>
* <p>Company: </p>
* @author unascribed
* @version 1.0
*/
public class ConfigParser extends DefaultHandler
{
private Properties props;
private String currentSet;
private String currentName;
private StringBuffer currentValue;
public ConfigParser()
{
currentValue = new StringBuffer();
props = new Properties();
}
public Properties getProps()
{
return props;
}
public void startElement(String uri, String localName, String qName, Attributes attributes)
throws SAXException
{
currentValue.delete(0, currentValue.length());
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, currentValue.toString().trim());
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -