com.github.axet.wget
Class SpeedInfo

java.lang.Object
  extended by com.github.axet.wget.SpeedInfo

public class SpeedInfo
extends Object


Nested Class Summary
 class SpeedInfo.Sample
           
 
Field Summary
protected  long peak
           
static int SAMPLE_LENGTH
           
static int SAMPLE_MAX
           
protected  ArrayList<SpeedInfo.Sample> samples
           
protected  SpeedInfo.Sample start
           
 
Constructor Summary
SpeedInfo()
           
 
Method Summary
protected  void add(SpeedInfo.Sample s)
           
 int getAverageSpeed()
          Average speed from start download
 int getCurrentSpeed()
          Current download speed
protected  long getLastUpdate()
           
 long getPeak()
           
protected  int getRowSamples()
          return number of samples in the row (before download restart)
 SpeedInfo.Sample getSample(int index)
           
 int getSamples()
           
protected  SpeedInfo.Sample getStart()
           
protected  void peakUpdate()
           
 void start(long current)
          Start calculate speed from 'current' bytes downloaded
 void step(long current)
          step download process with 'current' bytes downloaded
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SAMPLE_LENGTH

public static final int SAMPLE_LENGTH
See Also:
Constant Field Values

SAMPLE_MAX

public static final int SAMPLE_MAX
See Also:
Constant Field Values

samples

protected ArrayList<SpeedInfo.Sample> samples

peak

protected long peak

start

protected SpeedInfo.Sample start
Constructor Detail

SpeedInfo

public SpeedInfo()
Method Detail

start

public void start(long current)
Start calculate speed from 'current' bytes downloaded

Parameters:
current -

step

public void step(long current)
step download process with 'current' bytes downloaded

Parameters:
current -

getCurrentSpeed

public int getCurrentSpeed()
Current download speed

Returns:
bytes per second

getAverageSpeed

public int getAverageSpeed()
Average speed from start download

Returns:
bytes per second

getSamples

public int getSamples()

getSample

public SpeedInfo.Sample getSample(int index)

getPeak

public long getPeak()

getStart

protected SpeedInfo.Sample getStart()

add

protected void add(SpeedInfo.Sample s)

getRowSamples

protected int getRowSamples()
return number of samples in the row (before download restart)

Returns:

getLastUpdate

protected long getLastUpdate()

peakUpdate

protected void peakUpdate()


Copyright © 2012. All Rights Reserved.