com.go.trove.log
Class IntervalLogStream

java.lang.Object
  |
  +--java.io.OutputStream
        |
        +--com.go.trove.log.IntervalLogStream
Direct Known Subclasses:
DailyLogStream, HourlyLogStream

public abstract class IntervalLogStream
extends java.io.OutputStream

IntervalLogStream writes to an underlying OutputStream that is opened once per a specific time interval. This class forms the basis of a dated file logging mechanism.

Version:
16 , 9/07/00
Author:
Brian S O'Neill
See Also:
DailyFileLogStream

Inner Class Summary
static interface IntervalLogStream.Factory
           
 
Constructor Summary
IntervalLogStream(IntervalLogStream.Factory factory)
           
 
Method Summary
 void close()
          Closes any underlying OutputStreams and stops the auto-rollover thread if it is running.
protected  void finalize()
           
 void flush()
           
protected abstract  void moveToIntervalStart(java.util.Calendar cal)
          Moves calendar to beginning of log interval.
protected abstract  void moveToNextIntervalStart(java.util.Calendar cal)
          Moves calendar to beginning of next log interval.
 void startAutoRollover()
          Starts up a thread that automatically rolls the underlying OutputStream at the beginning of the interval, even if no output is written.
 void stopAutoRollover()
          If the auto-rollover thread was started, calling this method will stop it.
 void write(byte[] array)
           
 void write(byte[] array, int off, int len)
           
 void write(int b)
           
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IntervalLogStream

public IntervalLogStream(IntervalLogStream.Factory factory)
Method Detail

startAutoRollover

public void startAutoRollover()
Starts up a thread that automatically rolls the underlying OutputStream at the beginning of the interval, even if no output is written.

stopAutoRollover

public void stopAutoRollover()
If the auto-rollover thread was started, calling this method will stop it.

moveToIntervalStart

protected abstract void moveToIntervalStart(java.util.Calendar cal)
Moves calendar to beginning of log interval.

moveToNextIntervalStart

protected abstract void moveToNextIntervalStart(java.util.Calendar cal)
Moves calendar to beginning of next log interval.

write

public void write(int b)
           throws java.io.IOException
Overrides:
write in class java.io.OutputStream

write

public void write(byte[] array)
           throws java.io.IOException
Overrides:
write in class java.io.OutputStream

write

public void write(byte[] array,
                  int off,
                  int len)
           throws java.io.IOException
Overrides:
write in class java.io.OutputStream

flush

public void flush()
           throws java.io.IOException
Overrides:
flush in class java.io.OutputStream

close

public void close()
           throws java.io.IOException
Closes any underlying OutputStreams and stops the auto-rollover thread if it is running.
Overrides:
close in class java.io.OutputStream

finalize

protected void finalize()
                 throws java.io.IOException
Overrides:
finalize in class java.lang.Object