Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS | NEXT CLASS FRAMES  | NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD DETAIL:  FIELD | CONSTR | METHOD

Class ncsa.horizon.util.TimeStampPrintWriter

java.lang.Object
  |
  +--java.io.Writer
        |
        +--java.io.PrintWriter
              |
              +--ncsa.horizon.util.TimeStampPrintWriter

public class TimeStampPrintWriter
extends java.io.PrintWriter
This is a PrintWriter that adds a timestamp whenever println() is called It can be subclassed to provide timestamps with different formatting. This is done by overriding the method formatTimeStamp(). By default formatTimeStamp() calls getCannonicalFormat().


Field Summary
java.util.GregorianCalendar cal
           
 
Fields inherited from class java.io.PrintWriter
out
 
Fields inherited from class java.io.Writer
lock
 
Constructor Summary
TimeStampPrintWriter(java.io.Writer out, boolean autoFlush)
          uses out as the underlying output stream with/without autoflushing
TimeStampPrintWriter(java.io.Writer out)
          uses out as the underlying stream without autoflushing
TimeStampPrintWriter(java.io.OutputStream out)
          uses out as the underlying stream without autoflushing
TimeStampPrintWriter(java.io.OutputStream out, boolean autoFlush)
          uses out as the underlying output stream with/without autoflushing
 
Method Summary
java.lang.String formatTimeStamp()
          Override this method for custom timestamps
java.lang.String getCannonicalFormat()
          returns a timestamp in the cannonical format
java.lang.String getCompactFormat()
          returns the timestamp in a compact format, i.e.
static void main(java.lang.String[] args)
           
void print(java.lang.String s)
          overrides the superclass print(), by adding a timestamp
 
Methods inherited from class java.io.PrintWriter
checkError, close, flush, println, println, println, println, println, println, println, println, println, println, print, print, print, print, print, print, print, print, print, setError, write, write, write, write, write
 
Methods inherited from class java.io.Writer
close, flush, write, write, write, write, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notifyAll, notify, toString, wait, wait, wait
 

Field Detail

cal

protected java.util.GregorianCalendar cal
Constructor Detail

TimeStampPrintWriter

public TimeStampPrintWriter(java.io.Writer out,
                            boolean autoFlush)
uses out as the underlying output stream with/without autoflushing

TimeStampPrintWriter

public TimeStampPrintWriter(java.io.Writer out)
uses out as the underlying stream without autoflushing

TimeStampPrintWriter

public TimeStampPrintWriter(java.io.OutputStream out)
uses out as the underlying stream without autoflushing

TimeStampPrintWriter

public TimeStampPrintWriter(java.io.OutputStream out,
                            boolean autoFlush)
uses out as the underlying output stream with/without autoflushing
Method Detail

getCompactFormat

protected final java.lang.String getCompactFormat()
returns the timestamp in a compact format, i.e. MM/DD/YYYY, HH:MM:SS

getCannonicalFormat

protected final java.lang.String getCannonicalFormat()
returns a timestamp in the cannonical format

formatTimeStamp

protected java.lang.String formatTimeStamp()
Override this method for custom timestamps

print

public final void print(java.lang.String s)
overrides the superclass print(), by adding a timestamp
Overrides:
print in class java.io.PrintWriter

main

public static void main(java.lang.String[] args)

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS | NEXT CLASS FRAMES  | NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD DETAIL:  FIELD | CONSTR | METHOD