org.apache.james.util.watchdog
Class BytesReadResetInputStream

java.lang.Object
  |
  +--java.io.InputStream
        |
        +--org.apache.james.util.watchdog.BytesReadResetInputStream

public class BytesReadResetInputStream
extends InputStream

This will reset the Watchdog each time a certain amount of data has been transferred. This allows us to keep the timeout settings low, while not timing out during large data transfers.


Constructor Summary
BytesReadResetInputStream(InputStream in, Watchdog watchdog, 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

BytesReadResetInputStream

public BytesReadResetInputStream(InputStream in,
                                 Watchdog watchdog,
                                 int lengthReset)
Parameters:
in - the InputStream to be wrapped by this stream
watchdog - the watchdog to be reset
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 IOException
Read an array of bytes from the stream

Overrides:
read in class 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:
IOException - if an exception is encountered when reading

read

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

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

close

public void close()
           throws IOException
Close the stream

Overrides:
close in class InputStream
Throws:
IOException - if an exception is encountered when closing


"Copyright © 1999-2002 Apache Jakarta Project. All Rights Reserved."