从smack-config.xml文件中加载文件内容 Loads the configuration from the smack-config.xml file
来源:互联网 发布:双色球软件2016破解版 编辑:程序博客网 时间:2024/06/06 10:07
/**
* Loads the configuration from the smack-config.xml file.<p>
*
* So far this means that:
* 1) a set of classes will be loaded in order to execute their static init block
* 2) retrieve and set the current Smack release
*/
static {
try {
// Get an array of class loaders to try loading the providers files from.
ClassLoader[] classLoaders = getClassLoaders();
for (ClassLoader classLoader : classLoaders) {
Enumeration configEnum = classLoader.getResources("META-INF/smack-config.xml");
while (configEnum.hasMoreElements()) {
URL url = (URL) configEnum.nextElement();
InputStream systemStream = null;
try {
systemStream = url.openStream();
XmlPullParser parser = XmlPullParserFactory.newInstance().newPullParser();
parser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, true);
parser.setInput(systemStream, "UTF-8");
int eventType = parser.getEventType();
do {
if (eventType == XmlPullParser.START_TAG) {
if (parser.getName().equals("className")) {
// Attempt to load the class so that the class can get initialized
parseClassToLoad(parser);
}
else if (parser.getName().equals("packetReplyTimeout")) {
packetReplyTimeout = parseIntProperty(parser, packetReplyTimeout);
}
else if (parser.getName().equals("keepAliveInterval")) {
keepAliveInterval = parseIntProperty(parser, keepAliveInterval);
}
else if (parser.getName().equals("mechName")) {
defaultMechs.add(parser.nextText());
}
else if (parser.getName().equals("localSocks5ProxyEnabled")) {
localSocks5ProxyEnabled = Boolean.parseBoolean(parser.nextText());
}
else if (parser.getName().equals("localSocks5ProxyPort")) {
localSocks5ProxyPort = parseIntProperty(parser, localSocks5ProxyPort);
}
else if (parser.getName().equals("packetCollectorSize")) {
packetCollectorSize = parseIntProperty(parser, packetCollectorSize);
}
}
eventType = parser.next();
}
while (eventType != XmlPullParser.END_DOCUMENT);
}
catch (Exception e) {
e.printStackTrace();
}
finally {
try {
systemStream.close();
}
catch (Exception e) {
// Ignore.
}
}
}
}
}
catch (Exception e) {
e.printStackTrace();
}
}
0 1
- 从smack-config.xml文件中加载文件内容 Loads the configuration from the smack-config.xml file
- struts-config.xml文件
- Cordova config.xml文件
- struts-config.xml文件中配置数据源
- struts中struts-config.xml文件解释
- struts-config.xml文件详解
- struts-config.xml文件详解
- hibernate.config.xml文件详解
- 浅析struts-config.xml文件
- xml文件:<context:annotation-config/>
- 一个spring-config.xml文件
- mybatis-config.xml文件配置
- mybatis-config.xml文件配置
- struts-config.xml文件中的内容要按顺序放置
- ehcache config xml file
- applicationHost.config - Configuration file is not well-formed XML
- The Configuration File – “remote” Section – Git Config
- mybatis-config.xml:报SAXParseException: The content of element type "configuration" must match
- C# string 特殊的引用类型
- Spark1.0.0 学习路线
- Hadoop2.x的学习路线
- Spark1.0.0 on YARN 模式部署
- Delphi : WebBrowser、MSHTML在Delphi中的使用
- 从smack-config.xml文件中加载文件内容 Loads the configuration from the smack-config.xml file
- unity 武器拖尾效果实现的代码
- 破解YourKit Java Profiler 2014, build 14100
- Nosql学习
- mysql的分区技术
- 移除字符串中的字符和移除字符串数组中的字符
- Leetcode:Word Search
- TCP协议深入理解
- Spark1.0.0 on Standalone 模式部署