CarrotChat v2.8.60.240131版本的 MD5 值为:2baf8b9f31830b86b5c5a85ae6b47e05

以下内容为反编译后的 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(XmppElementCallback xmppElementCallback) {
        this(10000, xmppElementCallback);
    }

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

    @Override
    protected void onNextChar() throws IOException {
        if (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();
                this.xmppElementCallback.streamOpened(str, Collections.unmodifiableMap(map));
            }
        }
    }

    public XmppXmlSplitter(XmppElementCallback xmppElementCallback, DeclarationCallback declarationCallback, ProcessingInstructionCallback processingInstructionCallback) {
        this(10000, xmppElementCallback, declarationCallback, processingInstructionCallback);
    }

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

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