|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.io.OutputStream java.io.FilterOutputStream com.isti.util.TimestampOutputStream
Class TimestampOutputStream is an output stream filter that adds a timestamp of the current time in front of each line.
Field Summary | |
protected java.text.DateFormat |
dateFormatObj
|
protected static char |
NEWLINE_CHAR
|
protected boolean |
newlineFlag
|
Fields inherited from class java.io.FilterOutputStream |
out |
Constructor Summary | |
TimestampOutputStream(java.io.OutputStream streamObj)
Creates a timestamp output stream. |
|
TimestampOutputStream(java.io.OutputStream streamObj,
java.lang.String dateFormatStr)
Creates a timestamp output stream. |
Method Summary | |
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. |
Methods inherited from class java.io.FilterOutputStream |
close, flush |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected static final char NEWLINE_CHAR
protected boolean newlineFlag
protected final java.text.DateFormat dateFormatObj
Constructor Detail |
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.Method Detail |
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
ch
- character
java.io.IOException
public void write(byte[] data) throws java.io.IOException
data
- data array
java.io.IOException
public void write(byte[] data, int start, int len) throws java.io.IOException
data
- data arraystart
- start indexlen
- length
java.io.IOException
public void writeTimestamp() throws java.io.IOException
java.io.IOException
- if an I/O error occurs.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |