org.jivesoftware.smackx.filetransfer
Class FileTransfer

java.lang.Object
  extended by org.jivesoftware.smackx.filetransfer.FileTransfer
Direct Known Subclasses:
IncomingFileTransfer, OutgoingFileTransfer

public abstract class FileTransfer
extends java.lang.Object

Contains the generic file information and progress related to a particular file transfer.

Author:
Alexander Wenckus

Nested Class Summary
static class FileTransfer.Error
           
static class FileTransfer.Status
          A class to represent the current status of the file transfer.
 
Method Summary
abstract  void cancel()
          Cancels the file transfer.
 long getAmountWritten()
          Return the length of bytes written out to the stream.
 FileTransfer.Error getError()
          When getStatus() returns that there was an FileTransfer.Status.error during the transfer, the type of error can be retrieved through this method.
 java.lang.Exception getException()
          If an exception occurs asynchronously it will be stored for later retrival.
 java.lang.String getFileName()
          Returns the name of the file being transfered.
 java.lang.String getFilePath()
          Returns the local path of the file.
 long getFileSize()
          Returns the size of the file being transfered.
 java.lang.String getPeer()
          Returns the JID of the peer for this file transfer.
 double getProgress()
          Returns the progress of the file transfer as a number between 0 and 1.
 FileTransfer.Status getStatus()
          Retuns the current status of the file transfer.
 java.lang.String getStreamID()
           
 boolean isDone()
          Returns true if the transfer has been cancelled, if it has stopped because of a an error, or the transfer completed succesfully.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getFileSize

public long getFileSize()
Returns the size of the file being transfered.

Returns:
Returns the size of the file being transfered.

getFileName

public java.lang.String getFileName()
Returns the name of the file being transfered.

Returns:
Returns the name of the file being transfered.

getFilePath

public java.lang.String getFilePath()
Returns the local path of the file.

Returns:
Returns the local path of the file.

getPeer

public java.lang.String getPeer()
Returns the JID of the peer for this file transfer.

Returns:
Returns the JID of the peer for this file transfer.

getProgress

public double getProgress()
Returns the progress of the file transfer as a number between 0 and 1.

Returns:
Returns the progress of the file transfer as a number between 0 and 1.

isDone

public boolean isDone()
Returns true if the transfer has been cancelled, if it has stopped because of a an error, or the transfer completed succesfully.

Returns:
Returns true if the transfer has been cancelled, if it has stopped because of a an error, or the transfer completed succesfully.

getStatus

public FileTransfer.Status getStatus()
Retuns the current status of the file transfer.

Returns:
Retuns the current status of the file transfer.

getError

public FileTransfer.Error getError()
When getStatus() returns that there was an FileTransfer.Status.error during the transfer, the type of error can be retrieved through this method.

Returns:
Returns the type of error that occured if one has occured.

getException

public java.lang.Exception getException()
If an exception occurs asynchronously it will be stored for later retrival. If there is an error there maybe an exception set.

Returns:
The exception that occured or null if there was no exception.
See Also:
getError()

getStreamID

public java.lang.String getStreamID()

cancel

public abstract void cancel()
Cancels the file transfer.


getAmountWritten

public long getAmountWritten()
Return the length of bytes written out to the stream.

Returns:
the amount in bytes written out.