Smack

org.jivesoftware.smackx.filetransfer
Class FileTransferManager

java.lang.Object
  extended by org.jivesoftware.smackx.filetransfer.FileTransferManager

public class FileTransferManager
extends java.lang.Object

The file transfer manager class handles the sending and recieving of files. To send a file invoke the createOutgoingFileTransfer(String) method.

And to recieve 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.

Author:
Alexander Wenckus

Constructor Summary
FileTransferManager(Connection connection)
          Creates a file transfer manager to initiate and receive file transfers.
 
Method Summary
 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(java.lang.String userID)
          Creates an OutgoingFileTransfer to send a file to another user.
protected  void fireNewRequest(StreamInitiation initiation)
           
protected  void rejectIncomingFileTransfer(FileTransferRequest request)
           
 void removeFileTransferListener(FileTransferListener li)
          Removes a file transfer listener.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileTransferManager

public FileTransferManager(Connection connection)
Creates a file transfer manager to initiate and receive file transfers.

Parameters:
connection - The Connection that the file transfers will use.
Method Detail

addFileTransferListener

public void addFileTransferListener(FileTransferListener li)
Add a file transfer listener to listen to incoming file transfer requests.

Parameters:
li - The listener
See Also:
removeFileTransferListener(FileTransferListener), FileTransferListener

fireNewRequest

protected void fireNewRequest(StreamInitiation initiation)

removeFileTransferListener

public void removeFileTransferListener(FileTransferListener li)
Removes a file transfer listener.

Parameters:
li - The file transfer listener to be removed
See Also:
FileTransferListener

createOutgoingFileTransfer

public OutgoingFileTransfer createOutgoingFileTransfer(java.lang.String userID)
Creates an OutgoingFileTransfer to send a file to another user.

Parameters:
userID - 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 procede.

Parameters:
request - 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)

Smack

Copyright © 2003-2007 Jive Software.