FileDocCategorySizeDatePackage
RTInputStream.javaAPI DocExample1264Tue Jan 20 22:11:24 GMT 1998dcj.util.Bandwidth

RTInputStream

public 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 floataverageRate()

    return monitor.getAverageRate();
  
public floatlastRate()

    return monitor.getLastRate();
  
public intread()

    Date start = new Date();
    int b = super.read();
    monitor.addSample(1, start, new Date());
    return b;
  
public intread(byte[] data)

    Date start = new Date();
    int cnt = super.read(data);
    monitor.addSample(cnt, start, new Date());
    return cnt;
  
public intread(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;