• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java PacketExtensionProvider类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.jivesoftware.smack.provider.PacketExtensionProvider的典型用法代码示例。如果您正苦于以下问题:Java PacketExtensionProvider类的具体用法?Java PacketExtensionProvider怎么用?Java PacketExtensionProvider使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



PacketExtensionProvider类属于org.jivesoftware.smack.provider包,在下文中一共展示了PacketExtensionProvider类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: parseExtension

import org.jivesoftware.smack.provider.PacketExtensionProvider; //导入依赖的package包/类
/**
 * Parses a PEPEvent packet and extracts a PEPItem from it.
 * (There is only one per <event>.)
 *
 * @param parser the XML parser, positioned at the starting element of the extension.
 * @return a PacketExtension.
 * @throws Exception if a parsing error occurs.
 */
public PacketExtension parseExtension(XmlPullParser parser) throws Exception {

    boolean done = false;
    while (!done) {
        int eventType = parser.next();
        if (eventType == XmlPullParser.START_TAG) {
            if (parser.getName().equals("event")) {
            } else if (parser.getName().equals("items")) {
                // Figure out the node for this event.
                String node = parser.getAttributeValue("", "node");
                // Get the parser for this kind of node, and if found then parse the node.
                PacketExtensionProvider nodeParser = nodeParsers.get(node);
                if (nodeParser != null) {
                    pepItem = nodeParser.parseExtension(parser);
                }
             }
        } else if (eventType == XmlPullParser.END_TAG) {
            if (parser.getName().equals("event")) {
                done = true;
            }
        }
    }

    return pepItem;
}
 
开发者ID:ice-coffee,项目名称:EIM,代码行数:34,代码来源:PEPProvider.java


示例2: CcsClient

import org.jivesoftware.smack.provider.PacketExtensionProvider; //导入依赖的package包/类
private CcsClient() {
	// Add FcmPacketExtension
	ProviderManager.getInstance().addExtensionProvider(Util.FCM_ELEMENT_NAME, Util.FCM_NAMESPACE,
			new PacketExtensionProvider() {

				@Override
				public PacketExtension parseExtension(XmlPullParser parser) throws Exception {
					String json = parser.nextText();
					FcmPacketExtension packet = new FcmPacketExtension(json);
					return packet;
				}
			});
}
 
开发者ID:carlosCharz,项目名称:fcmxmppserver,代码行数:14,代码来源:CcsClient.java


示例3: parseExtension

import org.jivesoftware.smack.provider.PacketExtensionProvider; //导入依赖的package包/类
/**
 * Parses a PEPEvent packet and extracts a PEPItem from it. (There is only
 * one per <event>.)
 * 
 * @param parser
 *            the XML parser, positioned at the starting element of the
 *            extension.
 * @return a PacketExtension.
 * @throws Exception
 *             if a parsing error occurs.
 */
public PacketExtension parseExtension(XmlPullParser parser)
		throws Exception {

	boolean done = false;
	while (!done) {
		int eventType = parser.next();
		if (eventType == XmlPullParser.START_TAG) {
			if (parser.getName().equals("event")) {
			} else if (parser.getName().equals("items")) {
				// Figure out the node for this event.
				String node = parser.getAttributeValue("", "node");
				// Get the parser for this kind of node, and if found then
				// parse the node.
				PacketExtensionProvider nodeParser = nodeParsers.get(node);
				if (nodeParser != null) {
					pepItem = nodeParser.parseExtension(parser);
				}
			}
		} else if (eventType == XmlPullParser.END_TAG) {
			if (parser.getName().equals("event")) {
				done = true;
			}
		}
	}

	return pepItem;
}
 
开发者ID:ikantech,项目名称:xmppsupport_v2,代码行数:39,代码来源:PEPProvider.java


示例4: CcsClient

import org.jivesoftware.smack.provider.PacketExtensionProvider; //导入依赖的package包/类
private CcsClient() {
    // Add GcmPacketExtension
    ProviderManager.getInstance().addExtensionProvider(GCM_ELEMENT_NAME,
            GCM_NAMESPACE, new PacketExtensionProvider() {

                @Override
                public PacketExtension parseExtension(XmlPullParser parser)
                throws Exception {
                    String json = parser.nextText();
                    GcmPacketExtension packet = new GcmPacketExtension(json);
                    return packet;
                }
            });
}
 
开发者ID:writtmeyer,项目名称:gcm_server,代码行数:15,代码来源:CcsClient.java


示例5: addSimplePacketExtension

import org.jivesoftware.smack.provider.PacketExtensionProvider; //导入依赖的package包/类
private static void addSimplePacketExtension(final String name, final String namespace) {
	ProviderManager.getInstance().addExtensionProvider(name, namespace,
			new PacketExtensionProvider() {
				public PacketExtension parseExtension(XmlPullParser parser) throws Exception {
					StreamHandlingPacket packet = new StreamHandlingPacket(name, namespace);
					int attributeCount = parser.getAttributeCount();
					for (int i = 0; i < attributeCount; i++) {
						packet.addAttribute(parser.getAttributeName(i),
							parser.getAttributeValue(i));
					}
					return packet;
				}
			});
}
 
开发者ID:ufo22940268,项目名称:maven-yaxim,代码行数:15,代码来源:XmppStreamHandler.java


示例6: addSimplePacketExtension

import org.jivesoftware.smack.provider.PacketExtensionProvider; //导入依赖的package包/类
private static void addSimplePacketExtension(final String name, final String namespace) {
    ProviderManager.getInstance().addExtensionProvider(name, namespace,
            new PacketExtensionProvider() {
                public PacketExtension parseExtension(XmlPullParser parser) throws Exception {
                    StreamHandlingPacket packet = new StreamHandlingPacket(name, namespace);
                    int attributeCount = parser.getAttributeCount();
                    for (int i = 0; i < attributeCount; i++) {
                        packet.addAttribute(parser.getAttributeName(i),
                                parser.getAttributeValue(i));
                    }
                    return packet;
                }
            });
}
 
开发者ID:prive,项目名称:prive-android,代码行数:15,代码来源:XmppStreamHandler.java


示例7: parsePacketExtension

import org.jivesoftware.smack.provider.PacketExtensionProvider; //导入依赖的package包/类
/**
 * Parses a packet extension sub-packet.
 *
 * @param elementName the XML element name of the packet extension.
 * @param namespace the XML namespace of the packet extension.
 * @param parser the XML parser, positioned at the starting element of the extension.
 * @return a PacketExtension.
 * @throws Exception if a parsing error occurs.
 */
public static PacketExtension parsePacketExtension(String elementName, String namespace, XmlPullParser parser)
        throws Exception
{
    // See if a provider is registered to handle the extension.
    Object provider = ProviderManager.getInstance().getExtensionProvider(elementName, namespace);
    if (provider != null) {
        if (provider instanceof PacketExtensionProvider) {
            return ((PacketExtensionProvider)provider).parseExtension(parser);
        }
        else if (provider instanceof Class) {
            return (PacketExtension)parseWithIntrospection(
                    elementName, (Class)provider, parser);
        }
    }
    // No providers registered, so use a default extension.
    DefaultPacketExtension extension = new DefaultPacketExtension(elementName, namespace);
    boolean done = false;
    while (!done) {
        int eventType = parser.next();
        if (eventType == XmlPullParser.START_TAG) {
            String name = parser.getName();
            // If an empty element, set the value with the empty string.
            if (parser.isEmptyElementTag()) {
                extension.setValue(name,"");
            }
            // Otherwise, get the the element text.
            else {
                eventType = parser.next();
                if (eventType == XmlPullParser.TEXT) {
                    String value = parser.getText();
                    extension.setValue(name, value);
                }
            }
        }
        else if (eventType == XmlPullParser.END_TAG) {
            if (parser.getName().equals(elementName)) {
                done = true;
            }
        }
    }
    return extension;
}
 
开发者ID:ice-coffee,项目名称:EIM,代码行数:52,代码来源:PacketParserUtils.java


示例8: registerPEPParserExtension

import org.jivesoftware.smack.provider.PacketExtensionProvider; //导入依赖的package包/类
public void registerPEPParserExtension(String node, PacketExtensionProvider pepItemParser) {
    nodeParsers.put(node, pepItemParser);
}
 
开发者ID:ice-coffee,项目名称:EIM,代码行数:4,代码来源:PEPProvider.java


示例9: parsePacketExtension

import org.jivesoftware.smack.provider.PacketExtensionProvider; //导入依赖的package包/类
/**
 * Parses a packet extension sub-packet.
 *
 * @param elementName the XML element name of the packet extension.
 * @param namespace the XML namespace of the packet extension.
 * @param parser the XML parser, positioned at the starting element of the extension.
 * @return a PacketExtension.
 * @throws Exception if a parsing error occurs.
 */
public static PacketExtension parsePacketExtension(String elementName, String namespace, XmlPullParser parser)
        throws Exception
{
    // See if a provider is registered to handle the extension.
    Object provider = ProviderManager.getInstance().getExtensionProvider(elementName, namespace);
    if (provider != null) {
        if (provider instanceof PacketExtensionProvider) {
            return ((PacketExtensionProvider)provider).parseExtension(parser);
        }
        else if (provider instanceof Class) {
            return (PacketExtension)parseWithIntrospection(
                    elementName, (Class<?>)provider, parser);
        }
    }
    // No providers registered, so use a default extension.
    DefaultPacketExtension extension = new DefaultPacketExtension(elementName, namespace);
    boolean done = false;
    while (!done) {
        int eventType = parser.next();
        if (eventType == XmlPullParser.START_TAG) {
            String name = parser.getName();
            // If an empty element, set the value with the empty string.
            if (parser.isEmptyElementTag()) {
                extension.setValue(name,"");
            }
            // Otherwise, get the the element text.
            else {
                eventType = parser.next();
                if (eventType == XmlPullParser.TEXT) {
                    String value = parser.getText();
                    extension.setValue(name, value);
                }
            }
        }
        else if (eventType == XmlPullParser.END_TAG) {
            if (parser.getName().equals(elementName)) {
                done = true;
            }
        }
    }
    return extension;
}
 
开发者ID:CJC-ivotten,项目名称:androidPN-client.,代码行数:52,代码来源:PacketParserUtils.java


示例10: parsePacketExtension

import org.jivesoftware.smack.provider.PacketExtensionProvider; //导入依赖的package包/类
/**
 * Parses a packet extension sub-packet.
 * 
 * @param elementName
 *            the XML element name of the packet extension.
 * @param namespace
 *            the XML namespace of the packet extension.
 * @param parser
 *            the XML parser, positioned at the starting element of the
 *            extension.
 * @return a PacketExtension.
 * @throws Exception
 *             if a parsing error occurs.
 */
public static PacketExtension parsePacketExtension(String elementName,
		String namespace, XmlPullParser parser) throws Exception {
	// See if a provider is registered to handle the extension.
	Object provider = ProviderManager.getInstance().getExtensionProvider(
			elementName, namespace);
	if (provider != null) {
		if (provider instanceof PacketExtensionProvider) {
			return ((PacketExtensionProvider) provider)
					.parseExtension(parser);
		} else if (provider instanceof Class) {
			return (PacketExtension) parseWithIntrospection(elementName,
					(Class) provider, parser);
		}
	}
	// No providers registered, so use a default extension.
	DefaultPacketExtension extension = new DefaultPacketExtension(
			elementName, namespace);
	boolean done = false;
	while (!done) {
		int eventType = parser.next();
		if (eventType == XmlPullParser.START_TAG) {
			String name = parser.getName();
			// If an empty element, set the value with the empty string.
			if (parser.isEmptyElementTag()) {
				extension.setValue(name, "");
			}
			// Otherwise, get the the element text.
			else {
				eventType = parser.next();
				if (eventType == XmlPullParser.TEXT) {
					String value = parser.getText();
					extension.setValue(name, value);
				}
			}
		} else if (eventType == XmlPullParser.END_TAG) {
			if (parser.getName().equals(elementName)) {
				done = true;
			}
		}
	}
	return extension;
}
 
开发者ID:ikantech,项目名称:xmppsupport_v2,代码行数:57,代码来源:PacketParserUtils.java


示例11: registerPEPParserExtension

import org.jivesoftware.smack.provider.PacketExtensionProvider; //导入依赖的package包/类
public void registerPEPParserExtension(String node,
		PacketExtensionProvider pepItemParser) {
	nodeParsers.put(node, pepItemParser);
}
 
开发者ID:ikantech,项目名称:xmppsupport_v2,代码行数:5,代码来源:PEPProvider.java



注:本文中的org.jivesoftware.smack.provider.PacketExtensionProvider类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java MapObjects类代码示例发布时间:2022-05-21
下一篇:
Java Port类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap