com.caucho.vfs
Class RotateStream

java.lang.Object
  |
  +--com.caucho.vfs.RotateStream
All Implemented Interfaces:
CronListener, java.util.EventListener

public class RotateStream
extends java.lang.Object
implements CronListener

Automatically-rotating streams. Normally, clients will call getStream instead of using the StreamImpl interface.


Method Summary
 boolean canWrite()
          True if the stream can write
static RotateStream create(Path path)
          Returns the rotate stream corresponding to this path
 WriteStream getStream()
          Gets the current write stream
 void handleCron(Cron cron)
          Handles a callback from an alarm.
 void setMaxRolloverCount(int count)
          Sets the maximum number of rolled logs.
 void setRolloverPeriod(long period)
          Sets the log rollover period, rounded up to the nearest hour.
 void setRolloverSize(int size)
          Sets the log rollover size, rounded up to the megabyte.
 void setTimestamp(java.lang.String timestamp)
          Sets the timestamp format.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

create

public static RotateStream create(Path path)
Returns the rotate stream corresponding to this path

setMaxRolloverCount

public void setMaxRolloverCount(int count)
Sets the maximum number of rolled logs.

setRolloverPeriod

public void setRolloverPeriod(long period)
Sets the log rollover period, rounded up to the nearest hour.
Parameters:
period - the new rollover period in milliseconds.

setRolloverSize

public void setRolloverSize(int size)
Sets the log rollover size, rounded up to the megabyte.
Parameters:
size - maximum size of the log file, rolled up to the nearest meg.

setTimestamp

public void setTimestamp(java.lang.String timestamp)
Sets the timestamp format.

canWrite

public boolean canWrite()
True if the stream can write

getStream

public WriteStream getStream()
Gets the current write stream

handleCron

public void handleCron(Cron cron)
Description copied from interface: CronListener
Handles a callback from an alarm.
Specified by:
handleCron in interface CronListener