org.apache.james.util.watchdog
Class BytesReadResetInputStream
java.lang.Object
java.io.InputStream
org.apache.james.util.watchdog.BytesReadResetInputStream
- All Implemented Interfaces:
- java.io.Closeable
public class BytesReadResetInputStream
- extends java.io.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.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 |
BytesReadResetInputStream
public BytesReadResetInputStream(java.io.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 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 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:
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-2009 The Apache Software Foundation. All Rights Reserved.