Project JXTA

net.jxta.util
Class WatchedInputStream

java.lang.Object
  extended byjava.io.InputStream
      extended byjava.io.FilterInputStream
          extended bynet.jxta.util.WatchedInputStream
All Implemented Interfaces:
WatchedStream

public class WatchedInputStream
extends FilterInputStream
implements WatchedStream


Constructor Summary
WatchedInputStream(InputStream in)
           
WatchedInputStream(InputStream in, int chunkSize)
           
 
Method Summary
 void close()
          In case we want to close a watchStream regardless of its making progress.
 int read()
           
 int read(byte[] b)
           
 int read(byte[] b, int off, int len)
           
 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.
 
Methods inherited from class java.io.FilterInputStream
available, mark, markSupported, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

WatchedInputStream

public WatchedInputStream(InputStream in,
                          int chunkSize)

WatchedInputStream

public WatchedInputStream(InputStream in)
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

read

public int read()
         throws IOException
Throws:
IOException

read

public int read(byte[] b)
         throws IOException
Throws:
IOException

read

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

JXTA J2SE