导航菜单

页面标题

页面副标题

bbinstant v6.24.0 - SharedGroupsInfo.java 源代码

正在查看: bbinstant v6.24.0 应用的 SharedGroupsInfo.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package org.jivesoftware.smackx.sharedgroups.packet;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.roster.packet.RosterPacket;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;

public class SharedGroupsInfo extends IQ {
    public static final String ELEMENT = "sharedgroup";
    public static final String NAMESPACE = "http://www.jivesoftware.org/protocol/sharedgroup";
    private List<String> groups;

    public static class Provider extends IQProvider<SharedGroupsInfo> {
        @Override
        public SharedGroupsInfo parse(XmlPullParser xmlPullParser, int i) throws XmlPullParserException, IOException {
            SharedGroupsInfo sharedGroupsInfo = new SharedGroupsInfo();
            boolean z = false;
            while (!z) {
                int next = xmlPullParser.next();
                if (next == 2 && xmlPullParser.getName().equals(RosterPacket.Item.GROUP)) {
                    sharedGroupsInfo.getGroups().add(xmlPullParser.nextText());
                } else if (next == 3 && xmlPullParser.getName().equals(SharedGroupsInfo.ELEMENT)) {
                    z = true;
                }
            }
            return sharedGroupsInfo;
        }
    }

    public SharedGroupsInfo() {
        super(ELEMENT, NAMESPACE);
        this.groups = new ArrayList();
    }

    public List<String> getGroups() {
        return this.groups;
    }

    @Override
    protected IQ.IQChildElementXmlStringBuilder getIQChildElementBuilder(IQ.IQChildElementXmlStringBuilder iQChildElementXmlStringBuilder) {
        iQChildElementXmlStringBuilder.rightAngleBracket();
        Iterator<String> it = this.groups.iterator();
        while (it.hasNext()) {
            iQChildElementXmlStringBuilder.element(RosterPacket.Item.GROUP, it.next());
        }
        return iQChildElementXmlStringBuilder;
    }
}