FileDocCategorySizeDatePackage
NullProducer.javaAPI DocExample1907Tue Feb 04 21:46:28 GMT 1997dcj.util.Bandwidth

ContentProducer

public class ContentProducer extends Object

Fields Summary
protected ContentProducer
source
protected ContentConsumer
dest
protected DataMonitor
monitor
Constructors Summary
public ContentProducer(InputStream src)


     
    source = new ContentProducer(src);
  
public ContentProducer(ContentProducer src)

    source = src;
  
public ContentProducer(OutputStream dst)

    dest = new ContentConsumer(dst);
  
public ContentProducer(ContentConsumer dst)

    dest = dst;
  
Methods Summary
protected byte[]doProduction()

    byte[] data = null;
    if (source != null) {
      data = source.produce();
    }

    return data;
  
protected booleanpostProduction(byte[] data)

    monitor.addSample(data.length);
    return true;
  
protected booleanpreProduction()

    if (monitor.getStart() == null)
      monitor.start();

    return true;
  
public byte[]produce()

    boolean success;
    byte[] data = null;
    success = preProduction();
    if (success)
      data = doProduction();
    if (success && data != null)
      success = postProduction(data);

    return data;
  
public voidsetDest(ContentConsumer c)

    dest = c;
  
public voidsetDest(java.io.OutputStream s)

    dest = new ContentConsumer(s);
  
public voidsetSource(dcj.util.Bandwidth.ContentProducer p)

    source = p;
  
public voidsetSource(java.io.InputStream s)

    source = new ContentProducer(s);