SchedulerNotifyInputStreampublic class SchedulerNotifyInputStream extends InputStream This will reset the scheduler each time a certain amount of data has
been transfered. This allows us to keep the timeout settings low, while
not timing out during large data transfers. |
Fields Summary |
---|
InputStream | inThe wrapped InputStream | org.apache.avalon.cornerstone.services.scheduler.TimeScheduler | schedulerThe scheduler managing the trigger to be reset by this stream | String | triggerNameThe name of the trigger | int | lengthResetThe number of bytes that need to be read before the counter is reset. | int | readCounterThe number of bytes read since the counter was last reset |
Methods Summary |
---|
public void | close()Close the stream
in.close();
| public int | read(byte[] b, int off, int len)Read an array of bytes from the stream
int l = in.read(b, off, len);
readCounter += l;
if (readCounter > lengthReset) {
readCounter -= lengthReset;
scheduler.resetTrigger(triggerName);
}
return l;
| public int | read()Read a byte from the stream
int b = in.read();
readCounter++;
if (readCounter > lengthReset) {
readCounter -= lengthReset;
scheduler.resetTrigger(triggerName);
}
return b;
|
|