public class SpeedInfo extends Object
| Modifier and Type | Class and Description |
|---|---|
class |
SpeedInfo.Sample |
| Modifier and Type | Field and Description |
|---|---|
protected long |
peak |
static int |
SAMPLE_LENGTH |
static int |
SAMPLE_MAX |
protected ArrayList<SpeedInfo.Sample> |
samples |
protected SpeedInfo.Sample |
start |
| Constructor and Description |
|---|
SpeedInfo() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
add(SpeedInfo.Sample s) |
void |
end(long current) |
int |
getAverageSpeed()
Average speed from start download
|
int |
getAverageSpeed(int stepsBack)
Average speed for maximum stepsBack steps
|
int |
getCurrentSpeed()
Current download speed
|
protected long |
getLastUpdate() |
long |
getPeak() |
protected int |
getRowSamples()
Number of samples
|
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
|
public static int SAMPLE_LENGTH
public static int SAMPLE_MAX
protected ArrayList<SpeedInfo.Sample> samples
protected long peak
protected SpeedInfo.Sample start
public void start(long current)
current - current lengthpublic void step(long current)
current - current lengthpublic void end(long current)
public int getCurrentSpeed()
public int getAverageSpeed()
public int getAverageSpeed(int stepsBack)
stepsBack - how many steps aproximatepublic int getSamples()
public SpeedInfo.Sample getSample(int index)
public long getPeak()
protected SpeedInfo.Sample getStart()
protected void add(SpeedInfo.Sample s)
protected int getRowSamples()
protected long getLastUpdate()
protected void peakUpdate()
Copyright © 2017. All rights reserved.