ClintHeyer.Httpd
Class Throttler

Slows down the sending of data to a stream

Field Summary
long rate
         Bytes per sec
long sent
         In ticks
long start
         Bytes sent
System.IO.Stream stream
         Stream to send too

Constructor Summary
Throttler(System.IO.Stream passthrough, long rate)
         Throttler. Slows down sending to a stream according to rate.

Property Summary
long Rate
         Gets or sets the rate (bytes per second)

Method Summary
long Write(byte[] data, int offset, int count)
         Write some bytes

Methods inherited from class System.Object
Equals, Finalize, GetHashCode, GetType, MemberwiseClone, ToString


Field Detail

rate

private long rate

Bytes per sec


sent

private long sent

In ticks


start

private long start

Bytes sent


stream

private System.IO.Stream stream

Stream to send too

Constructor Detail

Throttler

public Throttler(System.IO.Stream passthrough,
                 long rate)

Throttler. Slows down sending to a stream according to rate.

Parameters:
passthrough - Stream to send to
rate - Rate (bytes per second)
Property Detail

Rate

public long Rate

Gets or sets the rate (bytes per second)

Method Detail

Write

public long Write(byte[] data,
                  int offset,
                  int count)

Write some bytes

Parameters:
data - Data
offset - Offset
count - Number of bytes to write
Returns:
Returns speed at which data was sent