Codota Logo
FileTransferNegotiator.negotiateOutgoingTransfer
Code IndexAdd Codota to your IDE (free)

How to use
negotiateOutgoingTransfer
method
in
org.jivesoftware.smackx.filetransfer.FileTransferNegotiator

Best Java code snippets using org.jivesoftware.smackx.filetransfer.FileTransferNegotiator.negotiateOutgoingTransfer (Showing top 6 results out of 315)

  • Common ways to obtain FileTransferNegotiator
private void myMethod () {
FileTransferNegotiator f =
  • Codota IconXMPPConnection connection;FileTransferNegotiator.getInstanceFor(connection)
  • Codota IconConnection connection;new FileTransferNegotiator(connection)
  • Codota IconConnection connection;FileTransferNegotiator.getInstanceFor(connection)
  • Smart code suggestions by Codota
}
origin: igniterealtime/Smack

  @Test
  public void verifyForm() throws Exception {
    FileTransferNegotiator fileNeg = FileTransferNegotiator.getInstanceFor(connection);
    try {
      fileNeg.negotiateOutgoingTransfer(JidTestUtil.DUMMY_AT_EXAMPLE_ORG, "streamid", "file", 1024, null, 10);
    } catch (NoResponseException e) {
      // We do not expect an answer. This unit test only checks the request sent.
    }
    Stanza packet = connection.getSentPacket();
    String xml = packet.toXML(null).toString();
    assertTrue(xml.indexOf("var='stream-method' type='list-single'") != -1);
  }
}
origin: igniterealtime/Smack

private OutputStream negotiateStream(String fileName, long fileSize,
    String description) throws SmackException, XMPPException, InterruptedException {
  // Negotiate the file transfer profile
  if (!updateStatus(Status.initial, Status.negotiating_transfer)) {
    throw new IllegalStateChangeException();
  }
  StreamNegotiator streamNegotiator = negotiator.negotiateOutgoingTransfer(
      getPeer(), streamID, fileName, fileSize, description,
      RESPONSE_TIMEOUT);
  // Negotiate the stream
  if (!updateStatus(Status.negotiating_transfer, Status.negotiating_stream)) {
    throw new IllegalStateChangeException();
  }
  outputStream = streamNegotiator.createOutgoingStream(streamID,
      initiator, getPeer());
  if (!updateStatus(Status.negotiating_stream, Status.negotiated)) {
    throw new IllegalStateChangeException();
  }
  return outputStream;
}
origin: org.mobicents.resources/mobicents-slee-ra-xmpp-library

private OutputStream negotiateStream(String fileName, long fileSize,
    String description) throws XMPPException {
  // Negotiate the file transfer profile
  setStatus(Status.NEGOTIATING_TRANSFER);
  StreamNegotiator streamNegotiator = negotiator.negotiateOutgoingTransfer(
      getPeer(), streamID, fileName, fileSize, description,
      RESPONSE_TIMEOUT);
  if (streamNegotiator == null) {
    setStatus(Status.ERROR);
    setError(Error.NO_RESPONSE);
    return null;
  }
  if (!getStatus().equals(Status.NEGOTIATING_TRANSFER)) {
    return null;
  }
  // Negotiate the stream
  setStatus(Status.NEGOTIATING_STREAM);
  outputStream = streamNegotiator.createOutgoingStream(streamID,
      initiator, getPeer());
  if (!getStatus().equals(Status.NEGOTIATING_STREAM)) {
    return null;
  }
  setStatus(Status.NEGOTIATED);
  return outputStream;
}
origin: tiandawu/IotXmpp

private OutputStream negotiateStream(String fileName, long fileSize,
    String description) throws XMPPException {
  // Negotiate the file transfer profile
  if (!updateStatus(Status.initial, Status.negotiating_transfer)) {
    throw new XMPPException("Illegal state change");
  }
  StreamNegotiator streamNegotiator = negotiator.negotiateOutgoingTransfer(
      getPeer(), streamID, fileName, fileSize, description,
      RESPONSE_TIMEOUT);
  if (streamNegotiator == null) {
    setStatus(Status.error);
    setError(Error.no_response);
    return null;
  }
  // Negotiate the stream
  if (!updateStatus(Status.negotiating_transfer, Status.negotiating_stream)) {
    throw new XMPPException("Illegal state change");
  }
  outputStream = streamNegotiator.createOutgoingStream(streamID,
      initiator, getPeer());
  if (!updateStatus(Status.negotiating_stream, Status.negotiated)) {
    throw new XMPPException("Illegal state change");
  }
  return outputStream;
}
origin: org.igniterealtime.smack/smackx

private OutputStream negotiateStream(String fileName, long fileSize,
    String description) throws XMPPException {
  // Negotiate the file transfer profile
  if (!updateStatus(Status.initial, Status.negotiating_transfer)) {
    throw new XMPPException("Illegal state change");
  }
  StreamNegotiator streamNegotiator = negotiator.negotiateOutgoingTransfer(
      getPeer(), streamID, fileName, fileSize, description,
      RESPONSE_TIMEOUT);
  if (streamNegotiator == null) {
    setStatus(Status.error);
    setError(Error.no_response);
    return null;
  }
  // Negotiate the stream
  if (!updateStatus(Status.negotiating_transfer, Status.negotiating_stream)) {
    throw new XMPPException("Illegal state change");
  }
  outputStream = streamNegotiator.createOutgoingStream(streamID,
      initiator, getPeer());
  if (!updateStatus(Status.negotiating_stream, Status.negotiated)) {
    throw new XMPPException("Illegal state change");
  }
  return outputStream;
}
origin: org.littleshoot/smack-xmpp-3-2-2

private OutputStream negotiateStream(String fileName, long fileSize,
    String description) throws XMPPException {
  // Negotiate the file transfer profile
  if (!updateStatus(Status.initial, Status.negotiating_transfer)) {
    throw new XMPPException("Illegal state change");
  }
  StreamNegotiator streamNegotiator = negotiator.negotiateOutgoingTransfer(
      getPeer(), streamID, fileName, fileSize, description,
      RESPONSE_TIMEOUT);
  if (streamNegotiator == null) {
    setStatus(Status.error);
    setError(Error.no_response);
    return null;
  }
  // Negotiate the stream
  if (!updateStatus(Status.negotiating_transfer, Status.negotiating_stream)) {
    throw new XMPPException("Illegal state change");
  }
  outputStream = streamNegotiator.createOutgoingStream(streamID,
      initiator, getPeer());
  if (!updateStatus(Status.negotiating_stream, Status.negotiated)) {
    throw new XMPPException("Illegal state change");
  }
  return outputStream;
}
org.jivesoftware.smackx.filetransferFileTransferNegotiatornegotiateOutgoingTransfer

Javadoc

Send a request to another user to send them a file. The other user has the option of, accepting, rejecting, or not responding to a received file transfer request.

If they accept, the packet will contain the other user's chosen stream type to send the file across. The two choices this implementation provides to the other user for file transfer are SOCKS5 Bytestreams, which is the preferred method of transfer, and In-Band Bytestreams, which is the fallback mechanism.

The other user may choose to decline the file request if they do not desire the file, their client does not support JEP-0096, or if there are no acceptable means to transfer the file.

Finally, if the other user does not respond this method will return null after the specified timeout.

Popular methods of FileTransferNegotiator

  • getInstanceFor
    Returns the file transfer negotiator related to a particular connection. When this class is requeste
  • <init>
  • createDefaultInitiationForm
  • getNegotiator
  • getNextStreamID
    Returns a new, unique, stream ID to identify a file transfer.
  • getOutgoingNegotiator
  • getStreamMethodField
  • selectStreamNegotiator
    Selects an appropriate stream negotiator after examining the incoming file transfer request.
  • setServiceEnabled
    Enable the Jabber services related to file transfer on the particular connection.
  • configureConnection
  • createIQ
    A convience method to create an IQ packet.
  • connection
  • createIQ,
  • connection

Popular in Java

  • Reactive rest calls using spring rest template
  • setRequestProperty (URLConnection)
  • getSharedPreferences (Context)
  • onRequestPermissionsResult (Fragment)
  • Time (java.sql)
    Java representation of an SQL TIME value. Provides utilities to format and parse the time's represen
  • NumberFormat (java.text)
    The abstract base class for all number formats. This class provides the interface for formatting and
  • Arrays (java.util)
    This class contains various methods for manipulating arrays (such as sorting and searching). This cl
  • SortedMap (java.util)
    A map that has its keys ordered. The sorting is according to either the natural ordering of its keys
  • Stack (java.util)
    The Stack class represents a last-in-first-out (LIFO) stack of objects. It extends class Vector with
  • ZipFile (java.util.zip)
    This class provides random read access to a zip file. You pay more to read the zip file's central di
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now