Methods Summary |
---|
protected byte[] | doProduction(long limit)
byte[] data = null;
if (source != null) {
data = source.produce(limit);
}
return data;
|
protected boolean | postProduction(byte[] data, long limit)
return true;
|
protected boolean | preProduction(long limit)
return true;
|
public byte[] | produce(long limit)
// Record the start time.
Date start = new Date();
boolean success;
byte[] data = null;
success = preProduction(limit);
if (success)
data = doProduction(limit);
if (success && data != null)
success = postProduction(data, limit);
// Record the data sample in our monitor.
monitor.addSample(data.length, start, new Date());
// Pass the data on to our destination, if present
if (data != null && dest != null)
dest.consume(data);
return data;
|
public boolean | produceAll()
boolean success = false;
if (dest != null) {
byte[] data = produce(0);
while (data != null) {
success = dest.consume(data);
if (success)
data = produce(0);
else
data = null;
}
}
return success;
|
public void | setDest(ContentConsumer c)
dest = c;
|
public void | setSource(dcj.util.Bandwidth.ContentProducer p)
source = p;
|