public class TimestampOutputStream
extends java.io.FilterOutputStream
Modifier and Type | Field and Description |
---|---|
protected java.text.DateFormat |
dateFormatObj |
protected static char |
NEWLINE_CHAR |
protected boolean |
newlineFlag |
Constructor and Description |
---|
TimestampOutputStream(java.io.OutputStream streamObj)
Creates a timestamp output stream.
|
TimestampOutputStream(java.io.OutputStream streamObj,
java.lang.String dateFormatStr)
Creates a timestamp output stream.
|
Modifier and Type | Method and Description |
---|---|
void |
setDateFormatPattern(java.lang.String patternStr)
Sets the pattern string used to generate the timestamps.
|
void |
setDateFormatTimeZone(java.util.TimeZone timeZoneObj)
Sets the time zone used for the timestamps.
|
void |
write(byte[] data)
Writes the given data array.
|
void |
write(byte[] data,
int start,
int len)
Writes the given section of the given array.
|
void |
write(int ch)
Writes a character.
|
void |
writeTimestamp()
Writes a timestamp and ": " separator to the output stream.
|
protected static final char NEWLINE_CHAR
protected boolean newlineFlag
protected final java.text.DateFormat dateFormatObj
public TimestampOutputStream(java.io.OutputStream streamObj, java.lang.String dateFormatStr)
streamObj
- the output stream to use.dateFormatStr
- the date/time format to use, or null to use
the default "MMM dd yyyy HH:mm:ss" format.public TimestampOutputStream(java.io.OutputStream streamObj)
streamObj
- the output stream to use.public void setDateFormatPattern(java.lang.String patternStr)
patternStr
- the pattern string to apply.public void setDateFormatTimeZone(java.util.TimeZone timeZoneObj)
timeZoneObj
- the time zone to use.public void write(int ch) throws java.io.IOException
write
in class java.io.FilterOutputStream
ch
- characterjava.io.IOException
public void write(byte[] data) throws java.io.IOException
write
in class java.io.FilterOutputStream
data
- data arrayjava.io.IOException
public void write(byte[] data, int start, int len) throws java.io.IOException
write
in class java.io.FilterOutputStream
data
- data arraystart
- start indexlen
- lengthjava.io.IOException
public void writeTimestamp() throws java.io.IOException
java.io.IOException
- if an I/O error occurs.