思特奇智慧酒店云平台 v0.0.5版本的 MD5 值为:dedb172bb322639d79d7e0e26262fb5c
以下内容为反编译后的 Bytestream.java 源代码,内容仅作参考
package org.jivesoftware.smackx.bytestreams.socks5.packet;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.packet.NamedElement;
import org.jivesoftware.smack.util.Objects;
import org.jivesoftware.smack.util.StringUtils;
import org.jivesoftware.smack.util.XmlStringBuilder;
import org.jivesoftware.smackx.jingle.transports.jingle_s5b.elements.JingleS5BTransport;
public class Bytestream extends IQ {
public static final String ELEMENT = "query";
public static final String NAMESPACE = "http://jabber.org/protocol/bytestreams";
public Mode mode;
public String sessionID;
public final List<StreamHost> streamHosts;
public Activate toActivate;
public StreamHostUsed usedHost;
public static class AnonymousClass1 {
public static final int[] $SwitchMap$org$jivesoftware$smack$packet$IQ$Type = new int[IQ.Type.values().length];
static {
try {
$SwitchMap$org$jivesoftware$smack$packet$IQ$Type[IQ.Type.set.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
$SwitchMap$org$jivesoftware$smack$packet$IQ$Type[IQ.Type.result.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
try {
$SwitchMap$org$jivesoftware$smack$packet$IQ$Type[IQ.Type.get.ordinal()] = 3;
} catch (NoSuchFieldError unused3) {
}
}
}
public static class Activate implements NamedElement {
public static String ELEMENTNAME = "activate";
public final xw3 target;
public Activate(xw3 xw3Var) {
this.target = xw3Var;
}
@Override
public String getElementName() {
return ELEMENTNAME;
}
public xw3 getTarget() {
return this.target;
}
@Override
public XmlStringBuilder toXML(String str) {
XmlStringBuilder xmlStringBuilder = new XmlStringBuilder(this);
xmlStringBuilder.rightAngleBracket();
xmlStringBuilder.escape(getTarget());
xmlStringBuilder.closeElement(this);
return xmlStringBuilder;
}
}
public enum Mode {
tcp,
udp;
public static Mode fromName(String str) {
try {
return valueOf(str);
} catch (Exception unused) {
return tcp;
}
}
}
public static class StreamHost implements NamedElement {
public static String ELEMENTNAME = "streamhost";
public final xw3 JID;
public final String addy;
public final int port;
public StreamHost(xw3 xw3Var, String str) {
this(xw3Var, str, 0);
}
public String getAddress() {
return this.addy;
}
@Override
public String getElementName() {
return ELEMENTNAME;
}
public xw3 getJID() {
return this.JID;
}
public int getPort() {
return this.port;
}
public StreamHost(xw3 xw3Var, String str, int i) {
this.JID = (xw3) Objects.requireNonNull(xw3Var, "StreamHost JID must not be null");
this.addy = (String) StringUtils.requireNotNullOrEmpty(str, "StreamHost address must not be null");
this.port = i;
}
@Override
public XmlStringBuilder toXML(String str) {
XmlStringBuilder xmlStringBuilder = new XmlStringBuilder(this);
xmlStringBuilder.attribute("jid", getJID());
xmlStringBuilder.attribute("host", getAddress());
if (getPort() != 0) {
xmlStringBuilder.attribute("port", Integer.toString(getPort()));
} else {
xmlStringBuilder.attribute("zeroconf", "_jabber.bytestreams");
}
xmlStringBuilder.closeEmptyElement();
return xmlStringBuilder;
}
}
public static class StreamHostUsed implements NamedElement {
public static String ELEMENTNAME = "streamhost-used";
public final xw3 JID;
public StreamHostUsed(xw3 xw3Var) {
this.JID = xw3Var;
}
@Override
public String getElementName() {
return ELEMENTNAME;
}
public xw3 getJID() {
return this.JID;
}
@Override
public XmlStringBuilder toXML(String str) {
XmlStringBuilder xmlStringBuilder = new XmlStringBuilder(this);
xmlStringBuilder.attribute("jid", getJID());
xmlStringBuilder.closeEmptyElement();
return xmlStringBuilder;
}
}
public Bytestream() {
super("query", NAMESPACE);
this.mode = Mode.tcp;
this.streamHosts = new ArrayList();
}
public StreamHost addStreamHost(xw3 xw3Var, String str) {
return addStreamHost(xw3Var, str, 0);
}
public int countStreamHosts() {
return this.streamHosts.size();
}
@Override
public IQ.IQChildElementXmlStringBuilder getIQChildElementBuilder(IQ.IQChildElementXmlStringBuilder iQChildElementXmlStringBuilder) {
int i = AnonymousClass1.$SwitchMap$org$jivesoftware$smack$packet$IQ$Type[getType().ordinal()];
if (i == 1) {
iQChildElementXmlStringBuilder.optAttribute("sid", getSessionID());
iQChildElementXmlStringBuilder.optAttribute(JingleS5BTransport.ATTR_MODE, getMode());
iQChildElementXmlStringBuilder.rightAngleBracket();
if (getToActivate() == null) {
for (StreamHost streamHost : getStreamHosts()) {
iQChildElementXmlStringBuilder.append(streamHost.toXML((String) null));
}
} else {
iQChildElementXmlStringBuilder.append(getToActivate().toXML((String) null));
}
} else if (i == 2) {
iQChildElementXmlStringBuilder.rightAngleBracket();
iQChildElementXmlStringBuilder.optAppend(getUsedHost());
for (StreamHost streamHost2 : this.streamHosts) {
iQChildElementXmlStringBuilder.append(streamHost2.toXML((String) null));
}
} else if (i == 3) {
iQChildElementXmlStringBuilder.setEmptyElement();
} else {
throw new IllegalStateException();
}
return iQChildElementXmlStringBuilder;
}
public Mode getMode() {
return this.mode;
}
public String getSessionID() {
return this.sessionID;
}
public StreamHost getStreamHost(xw3 xw3Var) {
if (xw3Var == null) {
return null;
}
for (StreamHost streamHost : this.streamHosts) {
if (streamHost.getJID().a((CharSequence) xw3Var)) {
return streamHost;
}
}
return null;
}
public List<StreamHost> getStreamHosts() {
return Collections.unmodifiableList(this.streamHosts);
}
public Activate getToActivate() {
return this.toActivate;
}
public StreamHostUsed getUsedHost() {
return this.usedHost;
}
public void setMode(Mode mode) {
this.mode = mode;
}
public void setSessionID(String str) {
this.sessionID = str;
}
public void setToActivate(xw3 xw3Var) {
this.toActivate = new Activate(xw3Var);
}
public void setUsedHost(xw3 xw3Var) {
this.usedHost = new StreamHostUsed(xw3Var);
}
public StreamHost addStreamHost(xw3 xw3Var, String str, int i) {
StreamHost streamHost = new StreamHost(xw3Var, str, i);
addStreamHost(streamHost);
return streamHost;
}
public Bytestream(String str) {
this();
setSessionID(str);
}
public void addStreamHost(StreamHost streamHost) {
this.streamHosts.add(streamHost);
}
}