CryptoMessage v1.3.2版本的 MD5 值为:66c611ce56a11450659dc23697562928

以下内容为反编译后的 XmppXmlSplitter.java 源代码,内容仅作参考


package org.jxmpp.xml.splitter;

import java.io.IOException;
import java.util.Collections;
import java.util.Map;

public class XmppXmlSplitter extends XmlSplitter {
    private final int maxElementSize;
    private String streamPrefix;
    private final XmppElementCallback xmppElementCallback;

    public XmppXmlSplitter(XmlPrinter xmlPrinter) {
        this(-1, null, xmlPrinter);
    }

    public XmppXmlSplitter(int i, XmppElementCallback xmppElementCallback, XmlPrinter xmlPrinter) {
        this(i, xmppElementCallback, null, null, xmlPrinter);
    }

    public XmppXmlSplitter(int i, XmppElementCallback xmppElementCallback, DeclarationCallback declarationCallback, ProcessingInstructionCallback processingInstructionCallback, XmlPrinter xmlPrinter) {
        super(i, xmppElementCallback, declarationCallback, processingInstructionCallback, xmlPrinter);
        this.maxElementSize = i;
        this.xmppElementCallback = xmppElementCallback;
    }

    @Override
    protected void onNextChar() throws IOException {
        if (this.maxElementSize > 0 && getCurrentSplittedPartSize() >= this.maxElementSize) {
            throw new IOException("Max element size exceeded");
        }
    }

    @Override
    protected void onStartTag(String str, String str2, Map<String, String> map) {
        if ("stream".equals(str2)) {
            if ("http://etherx.jabber.org/streams".equals(map.get("xmlns:" + str))) {
                this.streamPrefix = str;
                newSplittedPart();
                XmppElementCallback xmppElementCallback = this.xmppElementCallback;
                if (xmppElementCallback != null) {
                    xmppElementCallback.streamOpened(str, Collections.unmodifiableMap(map));
                }
            }
        }
    }

    @Override
    protected void onEndTag(String str) {
        XmppElementCallback xmppElementCallback;
        String str2 = this.streamPrefix;
        if (str2 == null || !str.startsWith(str2)) {
            return;
        }
        if (!(this.streamPrefix + ":stream").equals(str) || (xmppElementCallback = this.xmppElementCallback) == null) {
            return;
        }
        xmppElementCallback.streamClosed();
    }
}