思特奇智慧酒店云平台 v0.0.5版本的 MD5 值为:dedb172bb322639d79d7e0e26262fb5c
以下内容为反编译后的 IBBTransferNegotiator.java 源代码,内容仅作参考
package org.jivesoftware.smackx.filetransfer;
import java.io.InputStream;
import java.io.OutputStream;
import org.jivesoftware.smack.SmackException;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.packet.Stanza;
import org.jivesoftware.smackx.bytestreams.ibb.InBandBytestreamManager;
import org.jivesoftware.smackx.bytestreams.ibb.InBandBytestreamRequest;
import org.jivesoftware.smackx.bytestreams.ibb.InBandBytestreamSession;
import org.jivesoftware.smackx.bytestreams.ibb.packet.Open;
import org.jivesoftware.smackx.si.packet.StreamInitiation;
public class IBBTransferNegotiator extends StreamNegotiator {
public final InBandBytestreamManager manager;
public static final class ByteStreamRequest extends InBandBytestreamRequest {
public ByteStreamRequest(InBandBytestreamManager inBandBytestreamManager, Open open) {
super(inBandBytestreamManager, open);
}
}
public IBBTransferNegotiator(XMPPConnection xMPPConnection) {
super(xMPPConnection);
this.manager = InBandBytestreamManager.getByteStreamManager(xMPPConnection);
}
@Override
public InputStream createIncomingStream(StreamInitiation streamInitiation) throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException, InterruptedException {
this.manager.ignoreBytestreamRequestOnce(streamInitiation.getSessionID());
return negotiateIncomingStream(initiateIncomingStream(connection(), streamInitiation));
}
@Override
public OutputStream createOutgoingStream(String str, xw3 xw3Var, xw3 xw3Var2) throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException, InterruptedException {
InBandBytestreamSession establishSession = this.manager.establishSession(xw3Var2, str);
establishSession.setCloseBothStreamsEnabled(true);
return establishSession.getOutputStream();
}
@Override
public String[] getNamespaces() {
return new String[]{"http://jabber.org/protocol/ibb"};
}
@Override
public InputStream negotiateIncomingStream(Stanza stanza) throws SmackException.NotConnectedException, InterruptedException {
InBandBytestreamSession accept = new ByteStreamRequest(this.manager, (Open) stanza).accept();
accept.setCloseBothStreamsEnabled(true);
return accept.getInputStream();
}
@Override
public void newStreamInitiation(xw3 xw3Var, String str) {
this.manager.ignoreBytestreamRequestOnce(str);
}
}