org.xnap.plugin.gift.net
Class GiFTDownloadContainer

java.lang.Object
  extended by org.xnap.transfer.AbstractTransfer
      extended by org.xnap.transfer.AbstractDownload
          extended by org.xnap.plugin.gift.net.GiFTDownloadContainer
All Implemented Interfaces:
Download, Transfer, TransferContainer

public class GiFTDownloadContainer
extends AbstractDownload

GiFTDownloadContainer

Version:
CVS $Id: GiFTDownloadContainer.java,v 1.6 2004/03/23 19:36:21 vanto Exp $
Author:
Tammo van Lessen

Field Summary
 
Fields inherited from class org.xnap.transfer.AbstractTransfer
logger, MIN_RECALC_INTERVAL, RECALC_INTERVAL, SOCKET_TIMEOUT
 
Fields inherited from interface org.xnap.transfer.Transfer
TRANSFER_TIMEOUT
 
Constructor Summary
GiFTDownloadContainer(GiFTDaemon daemon, java.lang.String filename, java.lang.String hash, long filesize)
          Constructor for GiFTDownloadContainer.
 
Method Summary
 GiFTDownload addSource(GiFTUser user, java.lang.String url)
           
 void cancel()
           
 void clearOrphaned()
           
 javax.swing.Action[] getActions()
          Returns the actions that can performed by the transfer.
 javax.swing.Action[] getActions(java.lang.String url)
           
 long getBytesTransferred()
          Returns how many bytes have been transferred since the transfer was started.
 long getCurrentRate()
          Returns the current download rate.
 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.
 java.lang.String getGID()
           
 java.lang.String getHash()
           
 javax.swing.Icon getIcon()
          Returns null.
 Peer getPeer()
          Returns the peer.
 Plugin getPlugin()
          Returns the plugin.
 Segment[] getSegments()
          Returns the segments for segmented downloads.
 GiFTDownload getSourceByURL(java.lang.String url)
           
 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 markChildren()
           
 void orphanMarkedChildren()
           
 void pause()
           
 void setCurrentRate(long currentRate)
           
 void setGID(java.lang.String gid)
           
 void setOffset(long offset)
           
 void setState(java.lang.String state)
          Invoked by Enginge when the download state changed.
 void setTotalBytesTransferred(long totalBytesTransferred)
           
 
Methods inherited from class org.xnap.transfer.AbstractDownload
add, addListListener, clearDone, getChildCount, getChildren, iterator, remove, removeListListener
 
Methods inherited from class org.xnap.transfer.AbstractTransfer
addStateListener, cleared, getAverageRate, getDescription, getElapsedTime, getQueuePosition, getRemainingTime, removeStateListener, stateChanged, toString, transferStarted, transferStopped
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.xnap.transfer.Transfer
addStateListener, cleared, getAverageRate, getDescription, getQueuePosition, getRemainingTime, removeStateListener
 

Constructor Detail

GiFTDownloadContainer

public GiFTDownloadContainer(GiFTDaemon daemon,
                             java.lang.String filename,
                             java.lang.String hash,
                             long filesize)
Constructor for GiFTDownloadContainer.

Parameters:
filename - DOCUMENT ME!
hash - DOCUMENT ME!
filesize - DOCUMENT ME!
transmit - DOCUMENT ME!
state - DOCUMENT ME!
Method Detail

cancel

public void cancel()

getFilename

public java.lang.String getFilename()
Description copied from interface: Transfer
Returns the filename that should be presented to the user.

Specified by:
getFilename in interface Transfer
Overrides:
getFilename in class AbstractTransfer
See Also:
xnap.net.ITransferContainer#getFilename()

getFilesize

public long getFilesize()
Description copied from interface: Transfer
Returns the final filesize.

Specified by:
getFilesize in interface Transfer
Overrides:
getFilesize in class AbstractTransfer
See Also:
xnap.net.ITransferContainer#getFilesize()

getPlugin

public Plugin getPlugin()
Description copied from interface: Transfer
Returns the plugin.


getActions

public javax.swing.Action[] getActions(java.lang.String url)
See Also:
xnap.transfer.Transfer#getActions()

getActions

public javax.swing.Action[] getActions()
Description copied from interface: Transfer
Returns the actions that can performed by the transfer.


getFile

public java.io.File getFile()
Description copied from interface: Transfer
Returns the file the transfer is using.

Returns:
null, if file is unknown; the file, otherwise
See Also:
xnap.transfer.Transfer#getFile()

getPeer

public Peer getPeer()
Description copied from interface: Transfer
Returns the peer.

See Also:
xnap.transfer.Transfer#getPeer()

getSegments

public Segment[] getSegments()
Description copied from interface: Transfer
Returns the segments for segmented downloads.

Specified by:
getSegments in interface Transfer
Overrides:
getSegments in class AbstractTransfer
Returns:
null, if segments are not supported (which means that there is only one segment that represents the whole file)

getStatus

public java.lang.String getStatus()
Description copied from interface: Transfer
Returns the current status that should be presented to the user.

See Also:
xnap.transfer.Transfer#getStatus()

getTotalBytesTransferred

public long getTotalBytesTransferred()
Description copied from interface: Transfer
Returns how many bytes have been transferred.

Returns:
number of transferred bytes
See Also:
xnap.transfer.Transfer#getTotalBytesTransferred()

isDone

public boolean isDone()
Description copied from interface: Transfer
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
See Also:
xnap.transfer.Transfer#isDone()

isRunning

public boolean isRunning()
Description copied from interface: Transfer
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
See Also:
xnap.transfer.Transfer#isRunning()

getBytesTransferred

public long getBytesTransferred()
Description copied from class: AbstractTransfer
Returns how many bytes have been transferred since the transfer was started.

Specified by:
getBytesTransferred in class AbstractTransfer
Returns:
number of transferred bytes
See Also:
xnap.transfer.AbstractTransfer#getBytesTransferred()

getCurrentRate

public long getCurrentRate()
Description copied from class: AbstractTransfer
Returns the current download rate. Take at least a RECALC_INTERVAL into account to avoid jumping values all the time.

Specified by:
getCurrentRate in interface Transfer
Overrides:
getCurrentRate in class AbstractTransfer
Returns:
byte / s
See Also:
xnap.transfer.Transfer#getCurrentRate()

markChildren

public void markChildren()

orphanMarkedChildren

public void orphanMarkedChildren()

clearOrphaned

public void clearOrphaned()

getSourceByURL

public GiFTDownload getSourceByURL(java.lang.String url)

addSource

public GiFTDownload addSource(GiFTUser user,
                              java.lang.String url)

getGID

public java.lang.String getGID()
Returns:
unique id

getHash

public java.lang.String getHash()
Returns:
unique hash

getIcon

public javax.swing.Icon getIcon()
Description copied from class: AbstractTransfer
Returns null.

Specified by:
getIcon in interface Transfer
Overrides:
getIcon in class AbstractTransfer

pause

public void pause()

setGID

public void setGID(java.lang.String gid)

setCurrentRate

public void setCurrentRate(long currentRate)

setOffset

public void setOffset(long offset)

setState

public void setState(java.lang.String state)
Invoked by Enginge when the download state changed.


setTotalBytesTransferred

public void setTotalBytesTransferred(long totalBytesTransferred)


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