导航菜单

页面标题

页面副标题

bbinstant v6.24.0 - HeadersExtension.java 源代码

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

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


package org.jivesoftware.smackx.shim.packet;

import java.util.Collections;
import java.util.List;
import org.jivesoftware.smack.packet.ExtensionElement;
import org.jivesoftware.smack.packet.Stanza;
import org.jivesoftware.smack.util.XmlStringBuilder;

public class HeadersExtension implements ExtensionElement {
    public static final String ELEMENT = "headers";
    public static final String NAMESPACE = "http://jabber.org/protocol/shim";
    private final List<Header> headers;

    public HeadersExtension(List<Header> list) {
        if (list != null) {
            this.headers = Collections.unmodifiableList(list);
        } else {
            this.headers = Collections.emptyList();
        }
    }

    public static HeadersExtension from(Stanza stanza) {
        return (HeadersExtension) stanza.getExtension(ELEMENT, NAMESPACE);
    }

    @Override
    public String getElementName() {
        return ELEMENT;
    }

    public List<Header> getHeaders() {
        return this.headers;
    }

    @Override
    public String getNamespace() {
        return NAMESPACE;
    }

    @Override
    public XmlStringBuilder toXML() {
        XmlStringBuilder xmlStringBuilder = new XmlStringBuilder((ExtensionElement) this);
        xmlStringBuilder.rightAngleBracket();
        xmlStringBuilder.append(this.headers);
        xmlStringBuilder.closeElement(this);
        return xmlStringBuilder;
    }
}