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.
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.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
BytesReadResetInputStream
public BytesReadResetInputStream(InputStream in,
Watchdog watchdog,
int lengthReset)
- Parameters:
in
- the InputStream to be wrapped by this streamwatchdog
- the watchdog to be resetlengthReset
- the number of bytes to be read in between trigger resets
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 streamoff
- the index in the array where we start writinglen
- 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."