Class FileTransferManager


  • public final class FileTransferManager
    extends org.jivesoftware.smack.Manager
    The file transfer manager class handles the sending and receiving of files. To send a file invoke the createOutgoingFileTransfer(EntityFullJid) method.

    And to receive a file add a file transfer listener to the manager. The listener will notify you when there is a new file transfer request. To create the IncomingFileTransfer object accept the transfer, or, if the transfer is not desirable reject it.

    • Method Detail

      • getInstanceFor

        public static FileTransferManager getInstanceFor​(org.jivesoftware.smack.XMPPConnection connection)
      • removeFileTransferListener

        public void removeFileTransferListener​(FileTransferListener li)
        Removes a file transfer listener.
        Parameters:
        li - TODO javadoc me please The file transfer listener to be removed
        See Also:
        FileTransferListener
      • createOutgoingFileTransfer

        public OutgoingFileTransfer createOutgoingFileTransfer​(org.jxmpp.jid.EntityFullJid userID)
        Creates an OutgoingFileTransfer to send a file to another user.
        Parameters:
        userID - TODO javadoc me please The fully qualified jabber ID (i.e. full JID) with resource of the user to send the file to.
        Returns:
        The send file object on which the negotiated transfer can be run.
        Throws:
        java.lang.IllegalArgumentException - if userID is null or not a full JID
      • createIncomingFileTransfer

        protected IncomingFileTransfer createIncomingFileTransfer​(FileTransferRequest request)
        When the file transfer request is acceptable, this method should be invoked. It will create an IncomingFileTransfer which allows the transmission of the file to proceed.
        Parameters:
        request - TODO javadoc me please The remote request that is being accepted.
        Returns:
        The IncomingFileTransfer which manages the download of the file from the transfer initiator.
      • rejectIncomingFileTransfer

        protected void rejectIncomingFileTransfer​(FileTransferRequest request)
                                           throws org.jivesoftware.smack.SmackException.NotConnectedException,
                                                  java.lang.InterruptedException
        Reject an incoming file transfer.

        Specified in XEP-95 4.2 and 3.2 Example 8

        Parameters:
        request - TODO javadoc me please
        Throws:
        org.jivesoftware.smack.SmackException.NotConnectedException - if the XMPP connection is not connected.
        java.lang.InterruptedException - if the calling thread was interrupted.