com.evolution.player.core.network
Class Download

java.lang.Object
  extended by com.evolution.player.core.network.FileTransfer
      extended by com.evolution.player.core.network.Download
Direct Known Subclasses:
URLDownload

public abstract class Download
extends FileTransfer

Description of a download.

Clients can implement.

Since:
0.1
See Also:
IDownloadManager

Constructor Summary
Download(MediaInfo media)
          Create a new download downloading the given media.
 
Method Summary
abstract  LocalMediaInfo download(IProgressMonitor monitor)
          Download FileTransfer.getMediaInfo() and return the downloaded media if the download succeeded, throws IOException if the download failed, returns null if the monitor was canceled.
 int getLength()
          The length of the file to transfer in bytes.
 int getPercentage()
          The percentage transfered so far.
 double getSpeed()
          The current speed of the download in KB per second if know.
 int getTransfered()
          The amount of bytes transfered so far.
 
Methods inherited from class com.evolution.player.core.network.FileTransfer
getMediaInfo
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Download

public Download(MediaInfo media)
Create a new download downloading the given media.

Parameters:
media - the media to download
Method Detail

download

public abstract LocalMediaInfo download(IProgressMonitor monitor)
                                 throws java.io.IOException
Download FileTransfer.getMediaInfo() and return the downloaded media if the download succeeded, throws IOException if the download failed, returns null if the monitor was canceled.

Parameters:
monitor - a monitor to report progress to and the check for cancelation
Returns:
the downloaded media
Throws:
java.io.IOException - if something went wrong during the download

getSpeed

public double getSpeed()
Description copied from class: FileTransfer
The current speed of the download in KB per second if know.

Specified by:
getSpeed in class FileTransfer
Returns:
speed of the transfer in KB per second or -1 if unknown

getLength

public int getLength()
Description copied from class: FileTransfer
The length of the file to transfer in bytes.

Specified by:
getLength in class FileTransfer
Returns:
the length in bytes

getPercentage

public int getPercentage()
Description copied from class: FileTransfer
The percentage transfered so far.

Specified by:
getPercentage in class FileTransfer
Returns:
the progress of the transfer in percentage

getTransfered

public int getTransfered()
Description copied from class: FileTransfer
The amount of bytes transfered so far.

Specified by:
getTransfered in class FileTransfer
Returns:
the amount of transfered bytes