org.jivesoftware.spark.filetransfer
Class SparkTransferManager

java.lang.Object
  extended by org.jivesoftware.spark.filetransfer.SparkTransferManager

public class SparkTransferManager
extends java.lang.Object

Responsible for the handling of File Transfer within Spark. You would use the SparkManager for sending of images, files, multiple files and adding your own transfer listeners for plugin work.

Author:
Derek DeMoro

Method Summary
 void addTransferListener(FileTransferListener listener)
          Adds a new TransferListener to the SparkManager.
static java.awt.Image getClipboard()
          Returns an image if one is found in the clipboard, otherwise null is returned.
static SparkTransferManager getInstance()
          Returns the singleton instance of SparkTransferManager, creating it if necessary.
 void removeTransferListener(FileTransferListener listener)
          Removes the FileTransferListener.
 ChatRoom sendFile(java.io.File file, java.lang.String bJID)
          Send a file to a user.
 void sendFileTo(ContactItem item)
           
 void sendImage(java.awt.Image image, ChatRoom room)
          Send an image to a user.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static SparkTransferManager getInstance()
Returns the singleton instance of SparkTransferManager, creating it if necessary.

Returns:
the singleton instance of SparkTransferManager

sendFileTo

public void sendFileTo(ContactItem item)

sendFile

public ChatRoom sendFile(java.io.File file,
                         java.lang.String bJID)
Send a file to a user.

Parameters:
file - the file to send.
bJID - the bare jid of the user to send the file to.
Returns:
the ChatRoom of the user.

sendImage

public void sendImage(java.awt.Image image,
                      ChatRoom room)
Send an image to a user.

Parameters:
image - the image to send.
room - the ChatRoom of the user you wish to send the image to.

getClipboard

public static java.awt.Image getClipboard()
Returns an image if one is found in the clipboard, otherwise null is returned.

Returns:
the image in the clipboard if found, otherwise null.

addTransferListener

public void addTransferListener(FileTransferListener listener)
Adds a new TransferListener to the SparkManager. FileTransferListeners can be used to intercept incoming file transfers for own customizations. You may wish to not allow certain file transfers, or have your own UI to handle incoming files.

Parameters:
listener - the listener

removeTransferListener

public void removeTransferListener(FileTransferListener listener)
Removes the FileTransferListener.

Parameters:
listener - the listener