com.limegroup.gnutella
Interface BandwidthTracker

All Known Subinterfaces:
Downloader, Uploader
All Known Implementing Classes:
DownloadManager, HTTPDownloader, HTTPUploader, ManagedDownloader, UploadManager

public interface BandwidthTracker

This interface outlines the functionality that any class wanting to track bandwidth must implement. Typically a timer periodically calls measureBandwidth, leaving other threads free to call getMeasuredBandwidth.


Method Summary
 float getAverageBandwidth()
          Returns the overall averaged bandwidth between all calls of measureBandwidth
 float getMeasuredBandwidth()
          Returns the throughput of this in kilobytes/sec (KB/s) between the last two calls to measureBandwidth, or 0.0 if unknown.
 void measureBandwidth()
          Measures the data throughput since the last call to measureBandwidth.
 

Method Detail

measureBandwidth

public void measureBandwidth()
Measures the data throughput since the last call to measureBandwidth. This value can be read by calling getMeasuredBandwidth.


getMeasuredBandwidth

public float getMeasuredBandwidth()
                           throws InsufficientDataException
Returns the throughput of this in kilobytes/sec (KB/s) between the last two calls to measureBandwidth, or 0.0 if unknown.

Throws:
InsufficientDataException

getAverageBandwidth

public float getAverageBandwidth()
Returns the overall averaged bandwidth between all calls of measureBandwidth