本文整理汇总了Java中org.jivesoftware.smackx.carbons.packet.CarbonExtension类的典型用法代码示例。如果您正苦于以下问题:Java CarbonExtension类的具体用法?Java CarbonExtension怎么用?Java CarbonExtension使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CarbonExtension类属于org.jivesoftware.smackx.carbons.packet包,在下文中一共展示了CarbonExtension类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parse
import org.jivesoftware.smackx.carbons.packet.CarbonExtension; //导入依赖的package包/类
@Override
public CarbonExtension parse(XmlPullParser parser, int initialDepth)
throws SmackException, XmlPullParserException, IOException {
Direction dir = Direction.valueOf(parser.getName());
Forwarded fwd = null;
boolean done = false;
while (!done) {
int eventType = parser.next();
if (eventType == XmlPullParser.START_TAG && parser.getName().equals("forwarded")) {
fwd = FORWARDED_PROVIDER.parse(parser);
}
else if (eventType == XmlPullParser.END_TAG && dir == Direction.valueOf(parser.getName()))
done = true;
}
if (fwd == null)
throw new SmackException("sent/received must contain exactly one <forwarded> tag");
return new CarbonExtension(dir, fwd);
}
示例2: isSupportedByServer
import org.jivesoftware.smackx.carbons.packet.CarbonExtension; //导入依赖的package包/类
/**
* Returns true if XMPP Carbons are supported by the server.
*
* @return true if supported
* @throws NotConnectedException
* @throws XMPPErrorException
* @throws NoResponseException
*/
public boolean isSupportedByServer() throws NoResponseException, XMPPErrorException, NotConnectedException {
return ServiceDiscoveryManager.getInstanceFor(connection()).serverSupportsFeature(CarbonExtension.NAMESPACE);
}