Class TimeRotationStrategy
- java.lang.Object
-
- org.onebusaway.container.rotation.TimeRotationStrategy
-
- All Implemented Interfaces:
RotationStrategy
public class TimeRotationStrategy extends Object implements RotationStrategy
An implementation ofRotationStrategythat writes output to file whose named is specified using a format processed using the theSimpleDateFormatclass. This allows one to get standard time-based file rotation with whatever time granularity and formatting you may desire.- Author:
- bdferris
-
-
Constructor Summary
Constructors Constructor Description TimeRotationStrategy(String format)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description WritergetFirstWriter()WritergetNextWriter(Writer writer, int charactersWritten)Called to get the next output writer when a call is made toRotationWriter.flush().
-
-
-
Constructor Detail
-
TimeRotationStrategy
public TimeRotationStrategy(String format)
-
-
Method Detail
-
getFirstWriter
public Writer getFirstWriter() throws IOException
- Specified by:
getFirstWriterin interfaceRotationStrategy- Returns:
- the Writer that will be used for initial output
- Throws:
IOException
-
getNextWriter
public Writer getNextWriter(Writer writer, int charactersWritten) throws IOException
Description copied from interface:RotationStrategyCalled to get the next output writer when a call is made toRotationWriter.flush(). The current writer is provided as a parameter, so if no rotation should occur, just return the current writer.- Specified by:
getNextWriterin interfaceRotationStrategy- Parameters:
writer- the current output writercharactersWritten- the number of characters written to the current writer- Returns:
- the writer to output to in the future
- Throws:
IOException
-
-