Java 类org.jivesoftware.smackx.bytestreams.ibb.provider.DataPacketProvider 实例源码

项目:Zom-Android    文件:XmppStreamHandler.java   
private static void addSimplePacketExtension(final String name, final String namespace) {
    ProviderManager.addExtensionProvider(name, namespace,
            new DataPacketProvider.PacketExtensionProvider() {
                public Stanza 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;
                }
            });
}