public class NotifyingBufferedInputStream
extends java.io.BufferedInputStream
| Modifier and Type | Field and Description |
|---|---|
(package private) int |
chunk
The number of bytes read in the current chunk
|
(package private) int |
chunkSize
The number of bytes between notifications
|
(package private) StreamListener |
listener
The listener notified every chunk
|
| Constructor and Description |
|---|
NotifyingBufferedInputStream(java.io.InputStream is,
int size,
int chunkSize,
StreamListener listener)
Construct a notifying buffered inputstream.
|
| Modifier and Type | Method and Description |
|---|---|
void |
checkNotification(int result)
Checks whether a notification is required and
notifies as appropriate
|
int |
read() |
int |
read(byte[] b,
int off,
int len) |
void |
setStreamListener(StreamListener listener) |
int chunkSize
int chunk
StreamListener listener
public NotifyingBufferedInputStream(java.io.InputStream is,
int size,
int chunkSize,
StreamListener listener)
is - the input stream to be bufferedsize - the buffer sizechunkSize - the chunk sizelistener - the listener to notifyjava.lang.IllegalArgumentException - for a size <= 0 or chunkSize <= sizepublic void setStreamListener(StreamListener listener)
public int read()
throws java.io.IOException
read in class java.io.BufferedInputStreamjava.io.IOExceptionpublic int read(byte[] b,
int off,
int len)
throws java.io.IOException
read in class java.io.BufferedInputStreamjava.io.IOExceptionpublic void checkNotification(int result)
result - the number of bytes read