Load file content from smack-config.xml file Loads the configuration from the smack-config.xml file, smack

Source: Internet
Author: User

Load file content from smack-config.xml file Loads the configuration from the smack-config.xml file, smack


/**
* 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 ();
}
}
WWE SmackDown The latest theme song Divide The Day-Let it, in MP3 format,

Www.dbank.com/..c0dd04


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.