com.evolution.player.core.network
Class TransferProgressMonitor

java.lang.Object
  extended by com.evolution.player.core.network.TransferProgressMonitor

public class TransferProgressMonitor
extends java.lang.Object

A progress monitor which is used to measure progress for file transfers. The main feature of this progress monitor is that it can calculate the speed of a file transfer in KB per seconds.

Since:
0.6
See Also:
IDownloadManager.getProgressMonitor(Download)

Constructor Summary
TransferProgressMonitor()
           
 
Method Summary
 void beginTask(java.lang.String name, int totalWork)
           
 void done()
           
 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.
 void internalWorked(double work)
           
 boolean isCanceled()
           
 void setCanceled(boolean value)
           
 void setTaskName(java.lang.String name)
           
 void subTask(java.lang.String name)
           
 void worked(int work)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TransferProgressMonitor

public TransferProgressMonitor()
Method Detail

getLength

public int getLength()
The length of the file to transfer in bytes.

Returns:
the length in bytes

getTransfered

public int getTransfered()
The amount of bytes transfered so far.

Returns:
the amount of transfered bytes

getPercentage

public int getPercentage()
The percentage transfered so far.

Returns:
the progress of the transfer in percentage

getSpeed

public double getSpeed()
The current speed of the download in KB per second if know.

Returns:
speed of the transfer in KB per second or -1 if unknown

beginTask

public void beginTask(java.lang.String name,
                      int totalWork)

done

public void done()

internalWorked

public void internalWorked(double work)

isCanceled

public boolean isCanceled()

setCanceled

public void setCanceled(boolean value)

setTaskName

public void setTaskName(java.lang.String name)

subTask

public void subTask(java.lang.String name)

worked

public void worked(int work)