public class RolloverFileOutputStream extends FilterOutputStream
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.
out| 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) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
String |
getDatedFilename() |
String |
getFilename() |
int |
getRetainDays() |
static Calendar |
toMidnight(Calendar cal)
Get the "start of day" for the provided DateTime at the zone specified.
|
void |
write(byte[] buf) |
void |
write(byte[] buf,
int off,
int len) |
flush, writepublic RolloverFileOutputStream(String filename) throws IOException
filename - The filename must include the string "yyyy_mm_dd",
which is replaced with the actual date when creating and rolling over the file.IOException - if unable to create outputpublic RolloverFileOutputStream(String filename, boolean append) throws IOException
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.IOException - if unable to create outputpublic RolloverFileOutputStream(String filename, boolean append, int retainDays) throws IOException
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.IOException - if unable to create outputpublic RolloverFileOutputStream(String filename, boolean append, int retainDays, TimeZone zone) throws IOException
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.zone - the timezone for the outputIOException - if unable to create outputpublic RolloverFileOutputStream(String filename, boolean append, int retainDays, TimeZone zone, String dateFormat, String backupFormat) throws IOException
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.zone - the timezone for the outputdateFormat - 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".IOException - if unable to create outputpublic static Calendar toMidnight(Calendar cal)
cal - the date time to calculate frompublic String getFilename()
public String getDatedFilename()
public int getRetainDays()
public void write(byte[] buf)
throws IOException
write in class FilterOutputStreamIOExceptionpublic void write(byte[] buf,
int off,
int len)
throws IOException
write in class FilterOutputStreamIOExceptionpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class FilterOutputStreamIOExceptionCopyright © 1995-2017 Webtide. All Rights Reserved.