org.xnap.transfer
Class DccDownload

java.lang.Object
  extended by org.xnap.transfer.AbstractTransfer
      extended by org.xnap.transfer.DccDownload
All Implemented Interfaces:
Download, Transfer

public class DccDownload
extends AbstractTransfer
implements Download

Downloads a file via the dcc protocol.


Nested Class Summary
 class DccDownload.AcceptAction
          Starts the download offer.
 class DccDownload.RejectAction
          Rejects the download offer.
 class DccDownload.StopAction
          Starts the download offer.
 
Field Summary
 
Fields inherited from class org.xnap.transfer.AbstractTransfer
MIN_RECALC_INTERVAL, RECALC_INTERVAL, SOCKET_TIMEOUT
 
Fields inherited from interface org.xnap.transfer.Transfer
TRANSFER_TIMEOUT
 
Constructor Summary
DccDownload(Peer peer, java.lang.String filename, long filesize, java.lang.String host, int port)
           
 
Method Summary
 javax.swing.Action[] getActions()
          Returns the actions that can performed by the transfer.
 long getBytesTransferred()
          Returns how many bytes have been transferred since the transfer was started.
 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.
 Peer getPeer()
          Returns the peer.
 Plugin getPlugin()
          Returns the plugin.
 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 reject()
           
 void start()
           
 void stop()
           
 
Methods inherited from class org.xnap.transfer.AbstractTransfer
addStateListener, cleared, getAverageRate, getCurrentRate, getDescription, getElapsedTime, getIcon, getQueuePosition, getRemainingTime, getSegments, 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, getCurrentRate, getDescription, getIcon, getQueuePosition, getRemainingTime, getSegments, removeStateListener
 

Constructor Detail

DccDownload

public DccDownload(Peer peer,
                   java.lang.String filename,
                   long filesize,
                   java.lang.String host,
                   int port)
Parameters:
peer - the peer thae file is downloaded from
file - the destination file, the downloaded data is stored here
host - the host to connect to
port - the port to connect to
Method Detail

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:
AbstractTransfer.getCurrentRate()

getActions

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

Specified by:
getActions in interface Transfer

getFile

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

Specified by:
getFile in interface Transfer
Returns:
null, if file is unknown; the file, otherwise

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

getFilesize

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

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

getPeer

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

Specified by:
getPeer in interface Transfer

getPlugin

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

Specified by:
getPlugin in interface Transfer

getStatus

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

Specified by:
getStatus in interface Transfer

getTotalBytesTransferred

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

Specified by:
getTotalBytesTransferred in interface Transfer
Returns:
number of transferred bytes

isDone

public boolean isDone()
Description copied from interface: Transfer
Returns true if the transfer is finished.

Specified by:
isDone in interface Transfer
Returns:
true, if thread has ended and the transfer can be cleared; false if, not yet started or still running

isRunning

public boolean isRunning()
Description copied from interface: Transfer
Returns true if the transfer is running.

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

reject

public void reject()

start

public void start()

stop

public void stop()


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