RTInputStreampublic class RTInputStream extends FilterInputStream Source code from "Java Distributed Computing", by Jim Farley.
Class: RTInputStream
Example: 8-2
Description: An input stream that monitors its own "real time"
data throughput. |
Fields Summary |
---|
DataMonitor | monitor |
Constructors Summary |
---|
RTInputStream(InputStream in)
super(in);
monitor = new DataMonitor();
|
Methods Summary |
---|
public float | averageRate()
return monitor.getAverageRate();
| public float | lastRate()
return monitor.getLastRate();
| public int | read()
Date start = new Date();
int b = super.read();
monitor.addSample(1, start, new Date());
return b;
| public int | read(byte[] data)
Date start = new Date();
int cnt = super.read(data);
monitor.addSample(cnt, start, new Date());
return cnt;
| public int | read(byte[] data, int off, int len)
Date start = new Date();
int cnt = super.read(data, off, len);
monitor.addSample(cnt, start, new Date());
return cnt;
|
|