org.apache.james.util.watchdog
Class BytesWrittenResetOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by org.apache.james.util.watchdog.BytesWrittenResetOutputStream
All Implemented Interfaces:
java.io.Closeable, java.io.Flushable

public class BytesWrittenResetOutputStream
extends java.io.OutputStream

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
BytesWrittenResetOutputStream(java.io.OutputStream out, Watchdog watchdog, int lengthReset)
           
 
Method Summary
 void close()
          Close the stream
 void flush()
          Flush the stream
 void write(byte[] b, int off, int len)
          Write an array of bytes to the stream
 void write(int b)
          Write a byte to the stream
 
Methods inherited from class java.io.OutputStream
write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BytesWrittenResetOutputStream

public BytesWrittenResetOutputStream(java.io.OutputStream out,
                                     Watchdog watchdog,
                                     int lengthReset)
Method Detail

write

public void write(byte[] b,
                  int off,
                  int len)
           throws java.io.IOException
Write an array of bytes to the stream

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

write

public void write(int b)
           throws java.io.IOException
Write a byte to the stream

Specified by:
write in class java.io.OutputStream
Parameters:
b - the byte to write to the stream
Throws:
java.io.IOException - if an exception is encountered when writing

flush

public void flush()
           throws java.io.IOException
Flush the stream

Specified by:
flush in interface java.io.Flushable
Overrides:
flush in class java.io.OutputStream
Throws:
java.io.IOException - if an exception is encountered when flushing

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.OutputStream
Throws:
java.io.IOException - if an exception is encountered when closing


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