RTOutputStreampublic class RTOutputStream extends FilterOutputStream Source code from "Java Distributed Computing", by Jim Farley.
Class: RTOutputStream
Example: 8-3
Description: An output stream that monitors its own "real time"
data throughput. |
Fields Summary |
---|
DataMonitor | monitor |
Constructors Summary |
---|
RTOutputStream(OutputStream out)
super(out);
monitor = new DataMonitor();
|
Methods Summary |
---|
public float | averageRate()
return monitor.getAverageRate();
| public float | lastRate()
return monitor.getLastRate();
| public void | write(int b)
Date start = new Date();
super.write(b);
monitor.addSample(1, start, new Date());
| public void | write(byte[] data)
Date start = new Date();
super.write(data);
monitor.addSample(data.length, start, new Date());
| public void | write(byte[] data, int off, int len)
Date start = new Date();
super.write(data, off, len);
monitor.addSample(data.length, start, new Date());
|
|