org.apache.james.util
Class SchedulerNotifyInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by org.apache.james.util.SchedulerNotifyInputStream
All Implemented Interfaces:
java.io.Closeable

public class SchedulerNotifyInputStream
extends java.io.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.


Constructor Summary
SchedulerNotifyInputStream(java.io.InputStream in, org.apache.avalon.cornerstone.services.scheduler.TimeScheduler scheduler, java.lang.String triggerName, int lengthReset)
           
 
Method Summary
 void close()
          Close the stream
 int read()
          Read a byte from the stream
 int read(byte[] b, int off, int len)
          Read an array of bytes from the stream
 
Methods inherited from class java.io.InputStream
available, mark, markSupported, read, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SchedulerNotifyInputStream

public SchedulerNotifyInputStream(java.io.InputStream in,
                                  org.apache.avalon.cornerstone.services.scheduler.TimeScheduler scheduler,
                                  java.lang.String triggerName,
                                  int lengthReset)
Parameters:
in - the InputStream to be wrapped by this stream
scheduler - the TimeScheduler managing the trigger to be reset by this stream
triggerName - the name of the particular trigger to be reset by this stream
lengthReset - the number of bytes to be read in between trigger resets
Method Detail

read

public int read(byte[] b,
                int off,
                int len)
         throws java.io.IOException
Read an array of bytes from the stream

Overrides:
read in class java.io.InputStream
Parameters:
b - the array of bytes to read from the stream
off - the index in the array where we start writing
len - the number of bytes of the array to read
Returns:
the number of bytes read
Throws:
java.io.IOException - if an exception is encountered when reading

read

public int read()
         throws java.io.IOException
Read a byte from the stream

Specified by:
read in class java.io.InputStream
Returns:
the byte read from the stream
Throws:
java.io.IOException - if an exception is encountered when reading

close

public void close()
           throws java.io.IOException
Close the stream

Specified by:
close in interface java.io.Closeable
Overrides:
close in class java.io.InputStream
Throws:
java.io.IOException - if an exception is encountered when closing


Copyright © 2002-2007 The Apache Software Foundation. All Rights Reserved.