net.jxta.util
Class WatchedInputStream
java.lang.Object
java.io.InputStream
java.io.FilterInputStream
net.jxta.util.WatchedInputStream
- All Implemented Interfaces:
- Closeable, WatchedStream
public class WatchedInputStream
- extends FilterInputStream
- implements WatchedStream
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. |
WatchedInputStream
public WatchedInputStream(InputStream in,
int chunkSize)
WatchedInputStream
public WatchedInputStream(InputStream in)
toString
public String toString()
-
Debugging toString.
- Overrides:
toString
in class Object
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 Closeable
- Specified by:
close
in interface WatchedStream
- Overrides:
close
in class FilterInputStream
- Throws:
IOException
read
public int read()
throws IOException
- Overrides:
read
in class FilterInputStream
- Throws:
IOException
read
public int read(byte[] b)
throws IOException
- Overrides:
read
in class FilterInputStream
- Throws:
IOException
read
public int read(byte[] b,
int off,
int len)
throws IOException
- Overrides:
read
in class FilterInputStream
- Throws:
IOException