org.jboss.util.stream
Class NotifyingBufferedOutputStream
java.lang.Object
java.io.OutputStream
java.io.FilterOutputStream
java.io.BufferedOutputStream
org.jboss.util.stream.NotifyingBufferedOutputStream
- public class NotifyingBufferedOutputStream
- extends java.io.BufferedOutputStream
A buffered output stream that notifies every "chunk"
Fields inherited from class java.io.BufferedOutputStream |
buf, count |
Fields inherited from class java.io.FilterOutputStream |
out |
Methods inherited from class java.io.BufferedOutputStream |
flush |
Methods inherited from class java.io.FilterOutputStream |
close, write |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
NotifyingBufferedOutputStream
public NotifyingBufferedOutputStream(java.io.OutputStream os,
int size,
int chunkSize,
StreamListener (src) listener)
- Construct a notifying buffered outputstream.
The listener is notified once every chunk.
- Parameters:
os
- the output stream to be bufferedsize
- the buffer sizechunkSize
- the chunk size
- Throws:
java.lang.IllegalArgumentException
- for a size <= 0 or chunkSize <= size or a null listener
setStreamListener
public void setStreamListener(StreamListener (src) listener)
write
public void write(int b)
throws java.io.IOException
- Throws:
java.io.IOException
write
public void write(byte[] b,
int off,
int len)
throws java.io.IOException
- Throws:
java.io.IOException
checkNotification
public void checkNotification(int result)
- Checks whether a notification is required and
notifies as appropriate
- Parameters:
result
- the number of bytes written