public class NotifyingBufferedOutputStream
extends java.io.BufferedOutputStream
| Modifier and Type | Field and Description |
|---|---|
(package private) int |
chunk
The number of bytes written 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 |
|---|
NotifyingBufferedOutputStream(java.io.OutputStream os,
int size,
int chunkSize,
StreamListener listener)
Construct a notifying buffered outputstream.
The listener is notified once every chunk. |
| Modifier and Type | Method and Description |
|---|---|
void |
checkNotification(int result)
Checks whether a notification is required and
notifies as appropriate
|
void |
setStreamListener(StreamListener listener) |
void |
write(byte[] b,
int off,
int len) |
void |
write(int b) |
int chunkSize
int chunk
StreamListener listener
public NotifyingBufferedOutputStream(java.io.OutputStream os,
int size,
int chunkSize,
StreamListener listener)
os - the output stream to be bufferedsize - the buffer sizechunkSize - the chunk sizelistener - java.lang.IllegalArgumentException - for a size <= 0 or chunkSize <= size or a null listenerpublic void setStreamListener(StreamListener listener)
public void write(int b)
throws java.io.IOException
write in class java.io.BufferedOutputStreamjava.io.IOExceptionpublic void write(byte[] b,
int off,
int len)
throws java.io.IOException
write in class java.io.BufferedOutputStreamjava.io.IOExceptionpublic void checkNotification(int result)
result - the number of bytes written