コード例 #1
0
  /**
   * Find out how fast we are downloading data for this torrent right now.
   *
   * @return The speed, in KB/s
   */
  public float getMeasuredBandwidth() {

    // Have our SimpleBandwidthTracker update its current speed right now
    measureBandwidth();

    // Get the current speed our SimpleBandwidthTracker has calculated
    return _tracker.getMeasuredBandwidth();
  }
コード例 #2
0
  /**
   * Have this object record that we downloaded some more bytes of file data.
   *
   * @param read The number of bytes we read
   */
  void readBytes(int read) {

    // Give the number to our SimpleBandwidthTracker
    _tracker.count(read);
  }
コード例 #3
0
  /**
   * Get the total average bandwidth, the number of bytes we've downloaded divided by the time since
   * we started downloading this torrent.
   *
   * @return The total average bandwidth speed, in KB/s
   */
  public float getAverageBandwidth() {

    // Ask the SimpleBandwidthTracker
    return _tracker.getAverageBandwidth();
  }
コード例 #4
0
  /**
   * Have our SimpleBandwidthTracker calculate the current speed it's downloading data.
   *
   * @return The speed, in KB/s
   */
  public void measureBandwidth() {

    // Ask our SimpleBandwidthTracker
    _tracker.measureBandwidth();
  }
コード例 #5
0
  /**
   * Get the total number of bytes we've downloaded while getting this torrent. If we download the
   * same part of the file twice, this number counts it both times.
   *
   * @return The size of data in bytes
   */
  public long getTotalAmountDownloaded() {

    // Ask our SimpleBandwidthTracker
    return _tracker.getTotalAmount();
  }