org.xnap.transfer
Interface Transfer

All Known Subinterfaces:
Download, Upload
All Known Implementing Classes:
AbstractDownload, AbstractTransfer, AbstractUpload, AzureusDownload, AzureusDownloadContainer, AzureusPeerDownload, DccDownload, DccUpload, FreewayDownload, GiFTDownload, GiFTDownloadContainer, GiFTUpload, JTellaDownload, JTellaDownloadContainer, LimeWireDownload, LimeWireUpload, OpenNapDirectBrowse, OpenNapDirectBrowseUpload, OpenNapDownload, OpenNapDownloadContainer, OpenNapUpload, OvernetDownload, OvernetUpload

public interface Transfer

Defines the requirements for classes that transfer data to or from a peer.


Field Summary
static int TRANSFER_TIMEOUT
          Transfers should be stopped, if stalled for this long.
 
Method Summary
 void addStateListener(StateListener l)
          Adds a status listener.
 void cleared()
          Invoked after the transfer was removed from the transfer manager because isDone == true.
 javax.swing.Action[] getActions()
          Returns the actions that can performed by the transfer.
 long getAverageRate()
          Returns the averate transfer rate.
 long getCurrentRate()
          Returns the current transfer rate.
 java.lang.String getDescription()
          Returns html formatted meta information that is displayed as a tooltip.
 java.io.File getFile()
          Returns the file the transfer is using.
 java.lang.String getFilename()
          Returns the filename that should be presented to the user.
 long getFilesize()
          Returns the final filesize.
 javax.swing.Icon getIcon()
          Returns a 16x16 icon.
 Peer getPeer()
          Returns the peer.
 Plugin getPlugin()
          Returns the plugin.
 int getQueuePosition()
          Returns the queue position.
 int getRemainingTime()
          Returns the remaining time until the download is finished.
 Segment[] getSegments()
          Returns the segments for segmented downloads.
 java.lang.String getStatus()
          Returns the current status that should be presented to the user.
 long getTotalBytesTransferred()
          Returns how many bytes have been transferred.
 boolean isDone()
          Returns true if the transfer is finished.
 boolean isRunning()
          Returns true if the transfer is running.
 void removeStateListener(StateListener l)
          Remove a state listener.
 

Field Detail

TRANSFER_TIMEOUT

static final int TRANSFER_TIMEOUT
Transfers should be stopped, if stalled for this long.

See Also:
Constant Field Values
Method Detail

addStateListener

void addStateListener(StateListener l)
Adds a status listener.


cleared

void cleared()
Invoked after the transfer was removed from the transfer manager because isDone == true.


getActions

javax.swing.Action[] getActions()
Returns the actions that can performed by the transfer.


getAverageRate

long getAverageRate()
Returns the averate transfer rate.

Returns:
byte / s

getCurrentRate

long getCurrentRate()
Returns the current transfer rate.

Returns:
byte / s

getDescription

java.lang.String getDescription()
Returns html formatted meta information that is displayed as a tooltip.

Returns:
null, if no meta information is available

getFile

java.io.File getFile()
Returns the file the transfer is using.

Returns:
null, if file is unknown; the file, otherwise

getFilename

java.lang.String getFilename()
Returns the filename that should be presented to the user.


getFilesize

long getFilesize()
Returns the final filesize.


getIcon

javax.swing.Icon getIcon()
Returns a 16x16 icon.


getPeer

Peer getPeer()
Returns the peer.


getPlugin

Plugin getPlugin()
Returns the plugin.


getQueuePosition

int getQueuePosition()
Returns the queue position.

Returns:
-1, if the transfer is not queued, the position otherwise.

getRemainingTime

int getRemainingTime()
Returns the remaining time until the download is finished.

Returns:
the remaining time in s or -1 if unknown

getSegments

Segment[] getSegments()
Returns the segments for segmented downloads.

Returns:
null, if segments are not supported (which means that there is only one segment that represents the whole file)

getStatus

java.lang.String getStatus()
Returns the current status that should be presented to the user.


getTotalBytesTransferred

long getTotalBytesTransferred()
Returns how many bytes have been transferred.

Returns:
number of transferred bytes

isDone

boolean isDone()
Returns true if the transfer is finished.

Returns:
true, if thread has ended and the transfer can be cleared; false if, not yet started or still running

isRunning

boolean isRunning()
Returns true if the transfer is running.

Returns:
true, if data is transferred or a connect is in progress; false, if queued, not yet started or done

removeStateListener

void removeStateListener(StateListener l)
Remove a state listener.



Copyright © 2001-2005 XNap Team. All Rights Reserved.