站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JBoss 4.0.1 sp1 common API Documentation 英文版文档

NotifyingBufferedOutputStream (JBoss/Common API) - JBoss 4.0.1 sp1 common API Documentation 英文版文档


org.jboss.util.stream
Class NotifyingBufferedOutputStream

java.lang.Object
  extended byjava.io.OutputStream
      extended byjava.io.FilterOutputStream
          extended byjava.io.BufferedOutputStream
              extended byorg.jboss.util.stream.NotifyingBufferedOutputStream

public class NotifyingBufferedOutputStream
extends BufferedOutputStream

A buffered output stream that notifies every "chunk"

Version:
$Revision: 1.2 $
Author:
Adrian Brock

Field Summary
 
Fields inherited from class java.io.BufferedOutputStream
buf, count
 
Fields inherited from class java.io.FilterOutputStream
out
 
Constructor Summary
NotifyingBufferedOutputStream(OutputStream os, int size, int chunkSize, StreamListener listener)
          Construct a notifying buffered outputstream.
The listener is notified once every chunk.
 
Method Summary
 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)
           
 
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
 

Constructor Detail

NotifyingBufferedOutputStream

public NotifyingBufferedOutputStream(OutputStream os,
                                     int size,
                                     int chunkSize,
                                     StreamListener listener)
Construct a notifying buffered outputstream.
The listener is notified once every chunk.

Parameters:
os - the output stream to be buffered
size - the buffer size
chunkSize - the chunk size
Throws:
IllegalArgumentException - for a size <= 0 or chunkSize <= size or a null listener
Method Detail

setStreamListener

public void setStreamListener(StreamListener listener)

write

public void write(int b)
           throws IOException
Throws:
IOException

write

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

checkNotification

public void checkNotification(int result)
Checks whether a notification is required and notifies as appropriate

Parameters:
result - the number of bytes written


Copyright © 2002 JBoss Group, LLC. All Rights Reserved.