|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jets3t.service.io.BytesProgressWatcher
public class BytesProgressWatcher
Utility class that tracks the number of bytes transferred from a source, and uses this information to calculate transfer rates and estimate end times. The watcher stores the number of bytes that will be transferred, the number of bytes that have been transferred in the current session and the time this has taken, and the number of bytes and time taken overal (eg for transfers that have been restarted).
Field Summary | |
---|---|
static int |
SECONDS_OF_HISTORY
The number of seconds worth of historical byte transfer information that will be stored and used to calculate the recent transfer rate. |
Constructor Summary | |
---|---|
BytesProgressWatcher(long bytesToTransfer)
Construct a watcher for a transfer that will involve a given number of bytes. |
Method Summary | |
---|---|
static double |
calculateOverallBytesPerSecond(BytesProgressWatcher[] progressWatchers)
|
static long |
calculateRecentByteRatePerSecond(BytesProgressWatcher[] progressWatchers)
|
static long |
calculateRemainingTime(BytesProgressWatcher[] progressWatchers)
|
long |
getBytesRemaining()
|
long |
getBytesToTransfer()
|
long |
getBytesTransferred()
|
double |
getRecentByteRatePerSecond()
|
long |
getRemainingTime()
|
void |
resetWatcher()
Resets the byte count and timer variables for a watcher. |
static long |
sumBytesToTransfer(BytesProgressWatcher[] progressWatchers)
|
static long |
sumBytesTransferred(BytesProgressWatcher[] progressWatchers)
|
void |
updateBytesTransferred(long byteCount)
Notifies this watcher that bytes have been transferred. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int SECONDS_OF_HISTORY
Constructor Detail |
---|
public BytesProgressWatcher(long bytesToTransfer)
bytesToTransfer
- the number of bytes that will be transferred, eg the size of a file being uploaded.Method Detail |
---|
public long getBytesToTransfer()
public void resetWatcher()
updateBytesTransferred(long)
), or
when a transfer is restarted (eg due to transmission errors).
public void updateBytesTransferred(long byteCount)
byteCount
- the number of bytes that have been transferred.public long getBytesTransferred()
public long getBytesRemaining()
public long getRemainingTime()
public double getRecentByteRatePerSecond()
SECONDS_OF_HISTORY
seconds before the current time.public static long sumBytesToTransfer(BytesProgressWatcher[] progressWatchers)
progressWatchers
- all the watchers involved in the same byte transfer operation.
public static long sumBytesTransferred(BytesProgressWatcher[] progressWatchers)
progressWatchers
- all the watchers involved in the same byte transfer operation.
public static long calculateRemainingTime(BytesProgressWatcher[] progressWatchers)
progressWatchers
- all the watchers involved in the same byte transfer operation.
public static double calculateOverallBytesPerSecond(BytesProgressWatcher[] progressWatchers)
progressWatchers
- all the watchers involved in the same byte transfer operation.
public static long calculateRecentByteRatePerSecond(BytesProgressWatcher[] progressWatchers)
progressWatchers
- all the watchers involved in the same byte transfer operation.
SECONDS_OF_HISTORY
seconds).
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |