net.sf.hermesftp.utils
Class TransferRateLimiter

java.lang.Object
  extended by net.sf.hermesftp.utils.TransferRateLimiter

public class TransferRateLimiter
extends java.lang.Object

Controls the upload/download bandwidth.

Author:
Behnke

Constructor Summary
TransferRateLimiter()
          Constructor.
TransferRateLimiter(double maxRate)
          Constructor.
 
Method Summary
 void execute(long byteCount)
          Updates the transfer rate statistics.
 double getCurrentTransferRate()
          Returns the current transfer rate.
 void init(double maxRate)
          Initializes the object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TransferRateLimiter

public TransferRateLimiter()
Constructor.


TransferRateLimiter

public TransferRateLimiter(double maxRate)
Constructor.

Parameters:
maxRate - KB per second.
Method Detail

init

public void init(double maxRate)
Initializes the object.

Parameters:
maxRate - The maximum transfer rate.

getCurrentTransferRate

public double getCurrentTransferRate()
Returns the current transfer rate.

Returns:
The transfer rate in KB per seconds.

execute

public void execute(long byteCount)
Updates the transfer rate statistics. If the maximum rate has been exceeded, the method pauses.

Parameters:
byteCount - The number of bytes previously transfered.


Copyright © 2005-2007 Lars Behnke. All Rights Reserved.