Class IncomingFileTransfer

  extended by org.jivesoftware.smackx.filetransfer.FileTransfer
      extended by org.jivesoftware.smackx.filetransfer.IncomingFileTransfer

public class IncomingFileTransfer
extends FileTransfer

An incoming file transfer is created when the FileTransferManager.createIncomingFileTransfer(FileTransferRequest) method is invoked. It is a file being sent to the local user from another user on the jabber network. There are two stages of the file transfer to be concerned with and they can be handled in different ways depending upon the method that is invoked on this class.

The first way that a file is recieved is by calling the recieveFile() method. This method, negotiates the appropriate stream method and then returns the InputStream to read the file data from.

The second way that a file can be recieved through this class is by invoking the recieveFile(File) method. This method returns immediatly and takes as its parameter a file on the local file system where the file recieved from the transfer will be put.

Alexander Wenckus

Nested Class Summary
Nested classes/interfaces inherited from class org.jivesoftware.smackx.filetransfer.FileTransfer
FileTransfer.Error, FileTransfer.Status
Field Summary
Fields inherited from class org.jivesoftware.smackx.filetransfer.FileTransfer
amountWritten, negotiator, streamID
Constructor Summary
protected IncomingFileTransfer(FileTransferRequest request, FileTransferNegotiator transferNegotiator)
Method Summary
 void cancel()
          Cancels the file transfer.
 InputStream recieveFile()
          Negotiates the stream method to transfer the file over and then returns the negotiated stream.
 void recieveFile(File file)
          This method negotitates the stream and then transfer's the file over the negotiated stream.
Methods inherited from class org.jivesoftware.smackx.filetransfer.FileTransfer
getAmountWritten, getError, getException, getFileName, getFilePath, getFileSize, getPeer, getProgress, getStatus, getStreamID, isDone, setError, setException, setFileInfo, setFileInfo, setStatus, updateStatus, writeToStream
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


protected IncomingFileTransfer(FileTransferRequest request,
                               FileTransferNegotiator transferNegotiator)
Method Detail


public InputStream recieveFile()
                        throws XMPPException
Negotiates the stream method to transfer the file over and then returns the negotiated stream.

The negotiated InputStream from which to read the data.
XMPPException - If there is an error in the negotiation process an exception is thrown.


public void recieveFile(File file)
                 throws XMPPException
This method negotitates the stream and then transfer's the file over the negotiated stream. The transfered file will be saved at the provided location.

This method will return immedialtly, file transfer progress can be monitored through several methods:

file - The location to save the file.
XMPPException - when the file transfer fails
IllegalArgumentException - This exception is thrown when the the provided file is either null, or cannot be written to.


public void cancel()
Description copied from class: FileTransfer
Cancels the file transfer.

Specified by:
cancel in class FileTransfer


Copyright © 2003-2007 Jive Software.