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.
| Modifier and Type | Field and Description |
|---|---|
| private static final ScheduledExecutorService | |
| private final boolean | |
| private File | |
| private final SimpleDateFormat | |
| private final SimpleDateFormat | |
| private String | |
| private final AutoLock | |
| private OutputStream | |
| private final int | |
| private ScheduledFuture | |
| pack-priv static final String | |
| pack-priv static final String | |
| pack-priv static final int | |
| pack-priv static final String |
| Access | Constructor and Description |
|---|---|
| public | RolloverFileOutputStream(String
The filename must include the string "yyyy_mm_dd",
which is replaced with the actual date when creating and rolling over the file. filename)
|
| public | RolloverFileOutputStream(String
The filename must include the string "yyyy_mm_dd",
which is replaced with the actual date when creating and rolling over the file. filename, boolean If true, existing files will be appended to. append)
|
| public | RolloverFileOutputStream(String
The filename must include the string "yyyy_mm_dd",
which is replaced with the actual date when creating and rolling over the file. filename, boolean If true, existing files will be appended to. append, int The number of days to retain files before deleting them. 0 to retain forever. retainDays)
|
| public | RolloverFileOutputStream(String
The filename must include the string "yyyy_mm_dd",
which is replaced with the actual date when creating and rolling over the file. filename, boolean If true, existing files will be appended to. append, int The number of days to retain files before deleting them. 0 to retain forever. retainDays, TimeZone the timezone for the output zone)
|
| public | RolloverFileOutputStream(String
The filename must include the string "yyyy_mm_dd",
which is replaced with the actual date when creating and rolling over the file. filename, boolean If true, existing files will be appended to. append, int The number of days to retain files before deleting them. 0 to retain forever. retainDays, TimeZone the timezone for the output zone, String The format for the date file substitution. The default is "yyyy_MM_dd". If set to the
empty string, the file is rolledover to the same filename, with the current file being renamed to the backup filename. dateFormat, String The format for the file extension of backup files. The default is "HHmmssSSS". backupFormat)
|
| pack-priv | RolloverFileOutputStream(String filename, boolean append, int retainDays, TimeZone zone, String dateFormat, String backupFormat, ZonedDateTime now)
|
| Modifier and Type | Method and Description |
|---|---|
| public void | close()
Overrides java. Implements java. |
| public void | flush()
Overrides java. Implements java. |
| public String | |
| public String | |
| public int | |
| pack-priv void | |
| private void | |
| protected void | |
| private void | |
| private void | |
| pack-priv void | |
| public static ZonedDateTime | Returns: start of the day of the date providedthe date time to calculate from now)Get the "start of day" for the provided DateTime at the zone specified. |
| public void | write(int
the b)byte.Implements abstract java. |
| public void | write(byte[]
the data. buf)Overrides java. b.length bytes from the specified byte array
to this output stream.
|
| public void | write(byte[]
the data. buf, int the start offset in the data. off, int the number of bytes to write. len)Overrides java. len bytes from the specified byte array
starting at offset off to this output stream.
|
| __scheduler | back to summary |
|---|---|
| private static final ScheduledExecutorService __scheduler | |
| _append | back to summary |
|---|---|
| private final boolean _append | |
| _file | back to summary |
|---|---|
| private File _file | |
| _fileBackupFormat | back to summary |
|---|---|
| private final SimpleDateFormat _fileBackupFormat | |
| _fileDateFormat | back to summary |
|---|---|
| private final SimpleDateFormat _fileDateFormat | |
| _filename | back to summary |
|---|---|
| private String _filename | |
| _lock | back to summary |
|---|---|
| private final AutoLock _lock | |
| _out | back to summary |
|---|---|
| private OutputStream _out | |
| _retainDays | back to summary |
|---|---|
| private final int _retainDays | |
| _rollTask | back to summary |
|---|---|
| private ScheduledFuture<?> _rollTask | |
| ROLLOVER_FILE_BACKUP_FORMAT | back to summary |
|---|---|
| pack-priv static final String ROLLOVER_FILE_BACKUP_FORMAT | |
| ROLLOVER_FILE_DATE_FORMAT | back to summary |
|---|---|
| pack-priv static final String ROLLOVER_FILE_DATE_FORMAT | |
| ROLLOVER_FILE_RETAIN_DAYS | back to summary |
|---|---|
| pack-priv static final int ROLLOVER_FILE_RETAIN_DAYS | |
| YYYY_MM_DD | back to summary |
|---|---|
| pack-priv static final String YYYY_MM_DD | |
| RolloverFileOutputStream | back to summary |
|---|---|
public RolloverFileOutputStream(String filename) throws IOException
| |
| RolloverFileOutputStream | back to summary |
|---|---|
public RolloverFileOutputStream(String filename, boolean append) throws IOException
| |
| RolloverFileOutputStream | back to summary |
|---|---|
public RolloverFileOutputStream(String filename, boolean append, int retainDays) throws IOException
| |
| RolloverFileOutputStream | back to summary |
|---|---|
public RolloverFileOutputStream(String filename, boolean append, int retainDays, TimeZone zone) throws IOException
| |
| RolloverFileOutputStream | back to summary |
|---|---|
public RolloverFileOutputStream(String filename, boolean append, int retainDays, TimeZone zone, String dateFormat, String backupFormat) throws IOException
| |
| RolloverFileOutputStream | back to summary |
|---|---|
| pack-priv RolloverFileOutputStream(String filename, boolean append, int retainDays, TimeZone zone, String dateFormat, String backupFormat, ZonedDateTime now) throws IOException | |
| close | back to summary |
|---|---|
| public void close() throws IOException Overrides java. Implements java. Doc from java. Closes this output stream and releases any system resources
associated with this stream. The general contract of
| |
| flush | back to summary |
|---|---|
| public void flush() throws IOException Overrides java. Implements java. Doc from java. Flushes this output stream and forces any buffered output bytes
to be written out. The general contract of If the intended destination of this stream is an abstraction provided by the underlying operating system, for example a file, then flushing the stream guarantees only that bytes previously written to the stream are passed to the operating system for writing; it does not guarantee that they are actually written to a physical device such as a disk drive.
| |
| getDatedFilename | back to summary |
|---|---|
| public String getDatedFilename() | |
| getFilename | back to summary |
|---|---|
| public String getFilename() | |
| getRetainDays | back to summary |
|---|---|
| public int getRetainDays() | |
| removeOldFiles | back to summary |
|---|---|
| pack-priv void removeOldFiles(ZonedDateTime now) | |
| renameFile | back to summary |
|---|---|
| private void renameFile(File src, File dest) throws IOException | |
| rollover | back to summary |
|---|---|
| protected void rollover(File oldFile, File backupFile, File newFile) This method is called whenever a log file is rolled over | |
| rollOver | back to summary |
|---|---|
| private void rollOver() | |
| scheduleNextRollover | back to summary |
|---|---|
| private void scheduleNextRollover(ZonedDateTime now) | |
| setFile | back to summary |
|---|---|
| pack-priv void setFile(ZonedDateTime now) throws IOException | |
| toMidnight | back to summary |
|---|---|
| public static ZonedDateTime toMidnight(ZonedDateTime now) Get the "start of day" for the provided DateTime at the zone specified.
| |
| write | back to summary |
|---|---|
| public void write(int b) throws IOException Implements abstract java. Doc from java. Writes the specified byte to this output stream. The general
contract for
| |
| write | back to summary |
|---|---|
| public void write(byte[] buf) throws IOException Overrides java. Doc from java. Writes
| |
| write | back to summary |
|---|---|
| public void write(byte[] buf, int off, int len) throws IOException Overrides java. Doc from java. Writes
If
If
| |