Class DownloadStatsImpl
java.lang.Object
com.biglybt.pifimpl.local.download.DownloadStatsImpl
- All Implemented Interfaces:
DownloadStats
-
Field Summary
FieldsFields inherited from interface com.biglybt.pif.download.DownloadStats
HEALTH_ERROR, HEALTH_KO, HEALTH_NO_REMOTE, HEALTH_NO_TRACKER, HEALTH_OK, HEALTH_STOPPED
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfloat
Gives the currently seen availability of the torrentlong
Return the number of bytes of data fromt he torrent that is unavailable given the current sources (peers).int
if isChecking then returns completeness, 1000 -> 100%int
returns a value between 0 and 1000 giving the completion status of the current download task (e.g.long
Gives the number of bytes discarded.long
Gives average number of bytes downloaded in last secondlong
getDownloadAverage
(boolean include_protocol) int
getDownloadCompleted
(boolean bLive) Retrieve the level of download completion, *including* DND files.Gives access to the directory into which the download is being savedlong
Gives the number of bytes downloadedlong
getDownloaded
(boolean include_protocol) Gives the elapsed download time as a stringgetETA()
Gives the estimated time to completion as a stringlong
ETA time in seconds.long
Gives the number of bytes thrown away due to piece hash check failsint
returns an indication of the health of the torrentlong
Gives number of bytes remaining.long
long
Return the # of seconds that the torrent has been downloading.long
Return the # of seconds that the torrent has been only seeding.long
Returns the number of seconds running time since data was downloaded, -1 if neverlong
Returns the number of seconds running time since data was uploaded, -1 if neverint
Gives the share ratio of the torrent in 1000ths (i.e.Returns an overall string representing the state of the downloadgetStatus
(boolean localised) Returns an overall string representing the state of the download *localised*Gives access to the target file or directory that the download is being saved tolong
in ms since epochlong
Time that the torrent started seeding.long
Gives average number of bytes computed for torrent in last secondreturns an general status string for the trackerlong
Gives average number of bytes uploaded in last secondlong
getUploadAverage
(boolean include_protocol) long
Gives the number of bytes uploadedlong
getUploaded
(boolean include_protocol) void
resetUploadedDownloaded
(long new_up, long new_down) resets totals.
-
Field Details
-
dm
-
dm_stats
-
-
Constructor Details
-
DownloadStatsImpl
-
-
Method Details
-
getStatus
Description copied from interface:DownloadStats
Returns an overall string representing the state of the download- Specified by:
getStatus
in interfaceDownloadStats
- Returns:
-
getStatus
Description copied from interface:DownloadStats
Returns an overall string representing the state of the download *localised*- Specified by:
getStatus
in interfaceDownloadStats
- Returns:
-
getDownloadDirectory
Description copied from interface:DownloadStats
Gives access to the directory into which the download is being saved- Specified by:
getDownloadDirectory
in interfaceDownloadStats
- Returns:
-
getTargetFileOrDir
Description copied from interface:DownloadStats
Gives access to the target file or directory that the download is being saved to- Specified by:
getTargetFileOrDir
in interfaceDownloadStats
- Returns:
-
getTrackerStatus
Description copied from interface:DownloadStats
returns an general status string for the tracker- Specified by:
getTrackerStatus
in interfaceDownloadStats
- Returns:
-
getCompleted
public int getCompleted()Description copied from interface:DownloadStats
returns a value between 0 and 1000 giving the completion status of the current download task (e.g. checking, downloading)- Specified by:
getCompleted
in interfaceDownloadStats
- Returns:
-
getDownloadCompleted
public int getDownloadCompleted(boolean bLive) Description copied from interface:DownloadStats
Retrieve the level of download completion, *including* DND files. If the user has one or more DND file, return value will never reach 1000.To understand the bLive parameter, you must know a bit about the Torrent activation process:
1) Torrent goes into ST_WAITING
2) Torrent moves to ST_PREPARING
3) Torrent moves to ST_DOWNLOADING or ST_SEEDING
While in ST_PREPARING, Completion Level is rebuilt (either via Fast Resume or via piece checking). Quite often, the download completion level before ST_PREPARING and after ST_PREPARING are identical.
Before going into ST_PREPARING, we store the download completion level. If you wish to retrieve this value instead of the live "building" one, pass false for the parameter.
- Specified by:
getDownloadCompleted
in interfaceDownloadStats
- Parameters:
bLive
- true - Always returns the known completion level of the torrent false - In the case of ST_PREPARING, return completion level before of the torrent ST_PREPARING started. Otherwise, same as true.- Returns:
- 0 - 1000
-
getCheckingDoneInThousandNotation
public int getCheckingDoneInThousandNotation()Description copied from interface:DownloadStats
if isChecking then returns completeness, 1000 -> 100%- Specified by:
getCheckingDoneInThousandNotation
in interfaceDownloadStats
- Returns:
-
resetUploadedDownloaded
public void resetUploadedDownloaded(long new_up, long new_down) Description copied from interface:DownloadStats
resets totals. stops and restarts torrent if running to do so- Specified by:
resetUploadedDownloaded
in interfaceDownloadStats
-
getDownloaded
public long getDownloaded()Description copied from interface:DownloadStats
Gives the number of bytes downloaded- Specified by:
getDownloaded
in interfaceDownloadStats
- Returns:
-
getDownloaded
public long getDownloaded(boolean include_protocol) - Specified by:
getDownloaded
in interfaceDownloadStats
- Parameters:
include_protocol
-- Returns:
-
getRemaining
public long getRemaining()Description copied from interface:DownloadStats
Gives number of bytes remaining. *Includes* DND files- Specified by:
getRemaining
in interfaceDownloadStats
-
getRemainingExcludingDND
public long getRemainingExcludingDND()- Specified by:
getRemainingExcludingDND
in interfaceDownloadStats
-
getUploaded
public long getUploaded()Description copied from interface:DownloadStats
Gives the number of bytes uploaded- Specified by:
getUploaded
in interfaceDownloadStats
- Returns:
-
getUploaded
public long getUploaded(boolean include_protocol) - Specified by:
getUploaded
in interfaceDownloadStats
- Parameters:
include_protocol
-- Returns:
-
getDiscarded
public long getDiscarded()Description copied from interface:DownloadStats
Gives the number of bytes discarded. Does not includeDownloadStats.getHashFails()
(ex. end game mode where multiple peers send same block, et)- Specified by:
getDiscarded
in interfaceDownloadStats
- Returns:
-
getDownloadAverage
public long getDownloadAverage()Description copied from interface:DownloadStats
Gives average number of bytes downloaded in last second- Specified by:
getDownloadAverage
in interfaceDownloadStats
- Returns:
-
getDownloadAverage
public long getDownloadAverage(boolean include_protocol) - Specified by:
getDownloadAverage
in interfaceDownloadStats
- Parameters:
include_protocol
-- Returns:
-
getUploadAverage
public long getUploadAverage()Description copied from interface:DownloadStats
Gives average number of bytes uploaded in last second- Specified by:
getUploadAverage
in interfaceDownloadStats
- Returns:
-
getUploadAverage
public long getUploadAverage(boolean include_protocol) - Specified by:
getUploadAverage
in interfaceDownloadStats
- Parameters:
include_protocol
-- Returns:
-
getTotalAverage
public long getTotalAverage()Description copied from interface:DownloadStats
Gives average number of bytes computed for torrent in last second- Specified by:
getTotalAverage
in interfaceDownloadStats
- Returns:
-
getElapsedTime
Description copied from interface:DownloadStats
Gives the elapsed download time as a string- Specified by:
getElapsedTime
in interfaceDownloadStats
- Returns:
-
getETA
Description copied from interface:DownloadStats
Gives the estimated time to completion as a string- Specified by:
getETA
in interfaceDownloadStats
- Returns:
-
getETASecs
public long getETASecs()Description copied from interface:DownloadStats
ETA time in seconds.- Specified by:
getETASecs
in interfaceDownloadStats
- Returns:
- 0 = download is complete.
invalid input: '<' 0 = download is complete and it took -xxx time to complete.
-1 = unknown eta (no peer manager) or download completed 1s ago
315360000000L = incomplete and 0 average speed
-
getHashFails
public long getHashFails()Description copied from interface:DownloadStats
Gives the number of bytes thrown away due to piece hash check fails- Specified by:
getHashFails
in interfaceDownloadStats
- Returns:
-
getTimeStarted
public long getTimeStarted()Description copied from interface:DownloadStats
in ms since epoch- Specified by:
getTimeStarted
in interfaceDownloadStats
-
getAvailability
public float getAvailability()Description copied from interface:DownloadStats
Gives the currently seen availability of the torrent- Specified by:
getAvailability
in interfaceDownloadStats
- Returns:
-
getSecondsOnlySeeding
public long getSecondsOnlySeeding()Description copied from interface:DownloadStats
Return the # of seconds that the torrent has been only seeding. This number is totalled across sessions, and does not include the time seeding during the download phase.- Specified by:
getSecondsOnlySeeding
in interfaceDownloadStats
- Returns:
- -1 if it has never seeded
-
getSecondsDownloading
public long getSecondsDownloading()Description copied from interface:DownloadStats
Return the # of seconds that the torrent has been downloading. This number is totalled across sessions.- Specified by:
getSecondsDownloading
in interfaceDownloadStats
- Returns:
- -1 if it has never downloaded
-
getTimeStartedSeeding
public long getTimeStartedSeeding()Description copied from interface:DownloadStats
Time that the torrent started seeding.- Specified by:
getTimeStartedSeeding
in interfaceDownloadStats
- Returns:
- the difference, measured in milliseconds, between the torrent started seeding and midnight, January 1, 1970 UTC. see SystemTime.getCurrentTime(). -1 is not seeding
-
getSecondsSinceLastDownload
public long getSecondsSinceLastDownload()Description copied from interface:DownloadStats
Returns the number of seconds running time since data was downloaded, -1 if never- Specified by:
getSecondsSinceLastDownload
in interfaceDownloadStats
- Returns:
-
getSecondsSinceLastUpload
public long getSecondsSinceLastUpload()Description copied from interface:DownloadStats
Returns the number of seconds running time since data was uploaded, -1 if never- Specified by:
getSecondsSinceLastUpload
in interfaceDownloadStats
- Returns:
-
getHealth
public int getHealth()Description copied from interface:DownloadStats
returns an indication of the health of the torrent- Specified by:
getHealth
in interfaceDownloadStats
- Returns:
- see above HEALTH constants
-