FileDocCategorySizeDatePackage
RTOutputStream.javaAPI DocExample1228Sun Feb 01 15:39:24 GMT 1998dcj.util.Bandwidth

RTOutputStream

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

    return monitor.getAverageRate();
  
public floatlastRate()

    return monitor.getLastRate();
  
public voidwrite(int b)

    Date start = new Date();
    super.write(b);
    monitor.addSample(1, start, new Date());
  
public voidwrite(byte[] data)

    Date start = new Date();
    super.write(data);
    monitor.addSample(data.length, start, new Date());
  
public voidwrite(byte[] data, int off, int len)

    Date start = new Date();
    super.write(data, off, len);
    monitor.addSample(data.length, start, new Date());