Project JXTA

net.jxta.util
Class WatchedOutputStream

java.lang.Object
  extended byjava.io.OutputStream
      extended byjava.io.FilterOutputStream
          extended bynet.jxta.util.WatchedOutputStream
All Implemented Interfaces:
WatchedStream

public class WatchedOutputStream
extends FilterOutputStream
implements WatchedStream


Constructor Summary
WatchedOutputStream(OutputStream out)
           
WatchedOutputStream(OutputStream out, int chunkSize)
           
 
Method Summary
 void close()
          In case we want to close a watchStream regardless of its making progress.
 void flush()
           
 void setWatchList(Collection watchList)
          Sets the watcher list onto which this stream must register when it is not idle (so that it can be watched).
 String toString()
          

Debugging toString.

 void watch()
          This routine may be invoked as often as progress needs to be asserted.
 void write(byte[] b)
           
 void write(byte[] b, int off, int len)
           
 void write(int b)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

WatchedOutputStream

public WatchedOutputStream(OutputStream out,
                           int chunkSize)

WatchedOutputStream

public WatchedOutputStream(OutputStream out)
Method Detail

toString

public String toString()

Debugging toString.


setWatchList

public void setWatchList(Collection watchList)
Sets the watcher list onto which this stream must register when it is not idle (so that it can be watched). This implementation may or may not remain registered while idle. This may affect performance but not functionality. It is assumed that that list is monitored by a watcher task that invokes the watch method as often as needed to monitor progress to its satifaction.

Specified by:
setWatchList in interface WatchedStream
Parameters:
watchList - The watchList to register with. Must be a Synchronized Collection.

watch

public void watch()
Description copied from interface: WatchedStream
This routine may be invoked as often as progress needs to be asserted. After at most two watch cycles stalling is detected.

Specified by:
watch in interface WatchedStream

close

public void close()
           throws IOException
Description copied from interface: WatchedStream
In case we want to close a watchStream regardless of its making progress.

Specified by:
close in interface WatchedStream
Throws:
IOException

flush

public void flush()
           throws IOException
Throws:
IOException

write

public void write(int b)
           throws IOException
Throws:
IOException

write

public void write(byte[] b)
           throws IOException
Throws:
IOException

write

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

JXTA J2SE