org.jppf.utils.streams
Class NotifyingOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by org.jppf.utils.streams.NotifyingOutputStream
All Implemented Interfaces:
Closeable, Flushable

public class NotifyingOutputStream
extends OutputStream

Output stream that delegates writeoperations to an underlying stream, and sends notifications of how many bytes were written via a callback.

Author:
Laurent Cohen
See Also:
NotifyingStreamCallback, NotifyingOutputStream

Constructor Summary
NotifyingOutputStream(OutputStream delegate, NotifyingStreamCallback callback)
          Initialize this stream with the specified input stream.
 
Method Summary
 void close()
          
 void flush()
          
 void write(byte[] b)
          
 void write(byte[] b, int off, int len)
          
 void write(int n)
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NotifyingOutputStream

public NotifyingOutputStream(OutputStream delegate,
                             NotifyingStreamCallback callback)
Initialize this stream with the specified input stream.

Parameters:
delegate - the input stream to which operations are delegated.
callback - the callback to notify of stream operations.
Method Detail

write

public void write(int n)
           throws IOException

Specified by:
write in class OutputStream
Throws:
IOException

write

public void write(byte[] b)
           throws IOException

Overrides:
write in class OutputStream
Throws:
IOException

write

public void write(byte[] b,
                  int off,
                  int len)
           throws IOException

Overrides:
write in class OutputStream
Throws:
IOException

close

public void close()
           throws IOException

Specified by:
close in interface Closeable
Overrides:
close in class OutputStream
Throws:
IOException

flush

public void flush()
           throws IOException

Specified by:
flush in interface Flushable
Overrides:
flush in class OutputStream
Throws:
IOException


Copyright © 2005-2010 JPPF Team.