1.DaoService
public class DAOService {
public static String getPatternConfigValue(String m1, String m2) {
String value = null;
try {
value = XMLParserFactory.getInstance()
.getConfigParserByInputStream().getValue(m1, m2);
} catch (Exception e) {
}
return value;
}
public static String getPropertiesValue(String key) {
String value = null;
try {
value=XMLParserFactory.getInstance().getPropertiesParserByInputStream().getPropValue(key);
} catch (Exception e) {
//System.out.println("��ȡ" + key + "�������쳣:" + e.getMessage());
}
return value;
}
2.PropertiesParser
public class PropertiesParser {
private static Properties props=null;
public PropertiesParser(InputStream in)
{
try {
props=new Properties();
props.load(in);
in.close();
} catch (Exception e) {
}
}
public String getPropValue(String key)
{
String value=null;
if(props!=null && key!=null)
{
value=props.getProperty(key);
}
return value;
}
}