CarrotChat v2.8.80.240429版本的 MD5 值为:fdf98761f01e715a89df24b85b0d206e
以下内容为反编译后的 DataPacketExtension.java 源代码,内容仅作参考
package org.jivesoftware.smackx.bytestreams.ibb.packet;
import org.jivesoftware.smack.packet.ExtensionElement;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.util.XmlStringBuilder;
import org.jivesoftware.smack.util.stringencoder.Base64;
public class DataPacketExtension implements ExtensionElement {
public static final String ELEMENT = "data";
public static final String NAMESPACE = "http://jabber.org/protocol/ibb";
private final String data;
private byte[] decodedData;
private final long seq;
private final String sessionID;
public DataPacketExtension(String str, long j10, String str2) {
if (str != null && !"".equals(str)) {
if (j10 >= 0 && j10 <= 65535) {
if (str2 != null) {
this.sessionID = str;
this.seq = j10;
this.data = str2;
return;
}
throw new IllegalArgumentException("Data must not be null");
}
throw new IllegalArgumentException("Sequence must not be between 0 and 65535");
}
throw new IllegalArgumentException("Session ID must not be null or empty");
}
public String getData() {
return this.data;
}
public byte[] getDecodedData() {
byte[] bArr = this.decodedData;
if (bArr != null) {
return bArr;
}
if (this.data.matches(".*={1,2}+.+")) {
return null;
}
byte[] decode = Base64.decode(this.data);
this.decodedData = decode;
return decode;
}
@Override
public String getElementName() {
return "data";
}
public IQ.IQChildElementXmlStringBuilder getIQChildElementBuilder(IQ.IQChildElementXmlStringBuilder iQChildElementXmlStringBuilder) {
iQChildElementXmlStringBuilder.attribute("seq", Long.toString(this.seq));
iQChildElementXmlStringBuilder.attribute("sid", this.sessionID);
iQChildElementXmlStringBuilder.rightAngleBracket();
iQChildElementXmlStringBuilder.append((CharSequence) this.data);
return iQChildElementXmlStringBuilder;
}
@Override
public String getNamespace() {
return "http://jabber.org/protocol/ibb";
}
public long getSeq() {
return this.seq;
}
public String getSessionID() {
return this.sessionID;
}
@Override
public XmlStringBuilder toXML() {
IQ.IQChildElementXmlStringBuilder iQChildElementBuilder = getIQChildElementBuilder(new IQ.IQChildElementXmlStringBuilder(this));
iQChildElementBuilder.closeElement(this);
return iQChildElementBuilder;
}
}