Oracle

com.compoze.util
Class TimedFlushOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by java.io.FilterOutputStream
          extended by java.io.BufferedOutputStream
              extended by com.compoze.util.TimedFlushOutputStream
All Implemented Interfaces:
java.io.Closeable, java.io.Flushable, java.io.Serializable

public class TimedFlushOutputStream
extends java.io.BufferedOutputStream
implements java.io.Serializable

This class starts a background thread which flushes the underlying BufferedOutputStream at a given rate. The permission must be available to create a new thread.

See Also:
BufferedOutputStream, Serialized Form

Field Summary
 
Fields inherited from class java.io.BufferedOutputStream
buf, count
 
Fields inherited from class java.io.FilterOutputStream
out
 
Constructor Summary
TimedFlushOutputStream(java.io.OutputStream os, int iSize, long lFlushMillis)
          Constructor.
TimedFlushOutputStream(java.io.OutputStream os, long lFlushMillis)
          Constructor.
 
Method Summary
 void start()
          Create and start a new flush thread.
 void stop()
          Stop and destroy the flush thread.
 
Methods inherited from class java.io.BufferedOutputStream
flush, write, write
 
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

TimedFlushOutputStream

public TimedFlushOutputStream(java.io.OutputStream os,
                              long lFlushMillis)
Constructor.

Parameters:
os - underlying output stream
lFlushMillis - flush interval (in milliseconds)

TimedFlushOutputStream

public TimedFlushOutputStream(java.io.OutputStream os,
                              int iSize,
                              long lFlushMillis)
Constructor.

Parameters:
os - underlying output stream
iSize - size of output buffer
lFlushMillis - flush interval (in milliseconds)
Method Detail

stop

public void stop()
Stop and destroy the flush thread.


start

public void start()
Create and start a new flush thread.


Oracle

Copyright ©1999-2008 Oracle All rights reserved.