Class FileTransferManager
- java.lang.Object
-
- org.jivesoftware.smack.Manager
-
- org.jivesoftware.smackx.filetransfer.FileTransferManager
-
public final class FileTransferManager extends Manager
The file transfer manager class handles the sending and receiving of files. To send a file invoke thecreateOutgoingFileTransfer(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 Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addFileTransferListener(FileTransferListener li)
Add a file transfer listener to listen to incoming file transfer requests.protected IncomingFileTransfer
createIncomingFileTransfer(FileTransferRequest request)
When the file transfer request is acceptable, this method should be invoked.OutgoingFileTransfer
createOutgoingFileTransfer(EntityFullJid userID)
Creates an OutgoingFileTransfer to send a file to another user.static FileTransferManager
getInstanceFor(XMPPConnection connection)
protected void
rejectIncomingFileTransfer(FileTransferRequest request)
Reject an incoming file transfer.void
removeFileTransferListener(FileTransferListener li)
Removes a file transfer listener.-
Methods inherited from class org.jivesoftware.smack.Manager
connection, getAuthenticatedConnectionOrThrow, schedule, schedule, scheduleBlocking
-
-
-
-
Method Detail
-
getInstanceFor
public static FileTransferManager getInstanceFor(XMPPConnection connection)
-
addFileTransferListener
public void addFileTransferListener(FileTransferListener li)
Add a file transfer listener to listen to incoming file transfer requests.- Parameters:
li
- TODO javadoc me please The listener- See Also:
removeFileTransferListener(FileTransferListener)
,FileTransferListener
-
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(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:
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 SmackException.NotConnectedException, InterruptedException
Reject an incoming file transfer.Specified in XEP-95 4.2 and 3.2 Example 8
- Parameters:
request
- TODO javadoc me please- Throws:
SmackException.NotConnectedException
- if the XMPP connection is not connected.InterruptedException
- if the calling thread was interrupted.
-
-