org.eclipse.jetty.util

## Class RolloverFileOutputStream

- java.lang.Object
- - java.io.OutputStream
  - - java.io.FilterOutputStream
    - - org.eclipse.jetty.util.RolloverFileOutputStream

- All Implemented Interfaces:
    Closeable, Flushable, AutoCloseable

      public class RolloverFileOutputStream
      extends 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

    Constructors
    Constructor and Description
    `RolloverFileOutputStream(String filename)`
    `RolloverFileOutputStream(String filename, boolean append)`
    `RolloverFileOutputStream(String filename, boolean append, int retainDays)`
    `RolloverFileOutputStream(String filename, boolean append, int retainDays, TimeZone zone)`
    `RolloverFileOutputStream(String filename, boolean append, int retainDays, TimeZone zone, String dateFormat, String backupFormat)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()`
    `String` | `getDatedFilename()`
    `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(String filename)
                                   throws 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:
        `IOException`

    - #### RolloverFileOutputStream

          public RolloverFileOutputStream(String filename,
                                  boolean append)
                                   throws 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:
        `IOException`

    - #### RolloverFileOutputStream

          public RolloverFileOutputStream(String filename,
                                  boolean append,
                                  int retainDays)
                                   throws 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:
        `IOException`

    - #### RolloverFileOutputStream

          public RolloverFileOutputStream(String filename,
                                  boolean append,
                                  int retainDays,
                                  TimeZone zone)
                                   throws 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:
        `IOException`

    - #### RolloverFileOutputStream

          public RolloverFileOutputStream(String filename,
                                  boolean append,
                                  int retainDays,
                                  TimeZone zone,
                                  String dateFormat,
                                  String backupFormat)
                                   throws 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:
        `IOException`

  - ### Method Detail

    - #### getFilename

          public String getFilename()

    - #### getDatedFilename

          public String getDatedFilename()

    - #### getRetainDays

          public int getRetainDays()

    - #### write

          public void write(byte[] buf)
                     throws IOException

      Overrides:
        `write` in class `FilterOutputStream`
      Throws:
        `IOException`

    - #### write

          public void write(byte[] buf,
                   int off,
                   int len)
                     throws IOException

      Overrides:
        `write` in class `FilterOutputStream`
      Throws:
        `IOException`

    - #### close

          public void close()
                     throws IOException

      Specified by:
        `close` in interface `Closeable`
      Specified by:
        `close` in interface `AutoCloseable`
      Overrides:
        `close` in class `FilterOutputStream`
      Throws:
        `IOException`

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