org.eclipse.jetty.util
Class RolloverFileOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by java.io.FilterOutputStream
          extended by org.eclipse.jetty.util.RolloverFileOutputStream
All Implemented Interfaces:
java.io.Closeable, java.io.Flushable

public class RolloverFileOutputStream
extends java.io.FilterOutputStream

RolloverFileOutputStream This output stream puts content in a file that is rolled over every 24 hours. The filename must include the string "yyyy_mm_dd", which is replaced with the actual date when creating and rolling over the file. Old files are retained for a number of days before being deleted.


Field Summary
 
Fields inherited from class java.io.FilterOutputStream
out
 
Constructor Summary
RolloverFileOutputStream(java.lang.String filename)
           
RolloverFileOutputStream(java.lang.String filename, boolean append)
           
RolloverFileOutputStream(java.lang.String filename, boolean append, int retainDays)
           
RolloverFileOutputStream(java.lang.String filename, boolean append, int retainDays, java.util.TimeZone zone)
           
RolloverFileOutputStream(java.lang.String filename, boolean append, int retainDays, java.util.TimeZone zone, java.lang.String dateFormat, java.lang.String backupFormat)
           
 
Method Summary
 void close()
           
 java.lang.String getDatedFilename()
           
 java.lang.String getFilename()
           
 int getRetainDays()
           
 void write(byte[] buf)
           
 void write(byte[] buf, int off, int len)
           
 
Methods inherited from class java.io.FilterOutputStream
flush, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RolloverFileOutputStream

public RolloverFileOutputStream(java.lang.String filename)
                         throws java.io.IOException
Parameters:
filename - The filename must include the string "yyyy_mm_dd", which is replaced with the actual date when creating and rolling over the file.
Throws:
java.io.IOException

RolloverFileOutputStream

public RolloverFileOutputStream(java.lang.String filename,
                                boolean append)
                         throws java.io.IOException
Parameters:
filename - The filename must include the string "yyyy_mm_dd", which is replaced with the actual date when creating and rolling over the file.
append - If true, existing files will be appended to.
Throws:
java.io.IOException

RolloverFileOutputStream

public RolloverFileOutputStream(java.lang.String filename,
                                boolean append,
                                int retainDays)
                         throws java.io.IOException
Parameters:
filename - The filename must include the string "yyyy_mm_dd", which is replaced with the actual date when creating and rolling over the file.
append - If true, existing files will be appended to.
retainDays - The number of days to retain files before deleting them. 0 to retain forever.
Throws:
java.io.IOException

RolloverFileOutputStream

public RolloverFileOutputStream(java.lang.String filename,
                                boolean append,
                                int retainDays,
                                java.util.TimeZone zone)
                         throws java.io.IOException
Parameters:
filename - The filename must include the string "yyyy_mm_dd", which is replaced with the actual date when creating and rolling over the file.
append - If true, existing files will be appended to.
retainDays - The number of days to retain files before deleting them. 0 to retain forever.
Throws:
java.io.IOException

RolloverFileOutputStream

public RolloverFileOutputStream(java.lang.String filename,
                                boolean append,
                                int retainDays,
                                java.util.TimeZone zone,
                                java.lang.String dateFormat,
                                java.lang.String backupFormat)
                         throws java.io.IOException
Parameters:
filename - The filename must include the string "yyyy_mm_dd", which is replaced with the actual date when creating and rolling over the file.
append - If true, existing files will be appended to.
retainDays - The number of days to retain files before deleting them. 0 to retain forever.
dateFormat - The format for the date file substitution. The default is "yyyy_MM_dd".
backupFormat - The format for the file extension of backup files. The default is "HHmmssSSS".
Throws:
java.io.IOException
Method Detail

getFilename

public java.lang.String getFilename()

getDatedFilename

public java.lang.String getDatedFilename()

getRetainDays

public int getRetainDays()

write

public void write(byte[] buf)
           throws java.io.IOException
Overrides:
write in class java.io.FilterOutputStream
Throws:
java.io.IOException

write

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

close

public void close()
           throws java.io.IOException
Specified by:
close in interface java.io.Closeable
Overrides:
close in class java.io.FilterOutputStream
Throws:
java.io.IOException


Copyright © 1995-2010 Mort Bay Consulting. All Rights Reserved.