|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--xbn.XBNObject | +--xbn.output.MsgFormat | +--xbn.output.MFDate
A MsgFormat that precedes every line of output with a date-time stamp.
Source code: MFDate.java
SimpleDateFormat sdf = (new SimpleDateFormat("MM-dd-yyyy HH:mm:ss ")); sdf.setTimeZone(TimeZone.getTimeZone("EST")); MFDate MFDate = new MFDate(sdf);For further information, see Sun's documentation for java.text.SimpleDateFormat and java.text.TimeZone.
Fields inherited from class xbn.XBNObject |
bFALSE_IN_PRODUCTION, bTRUE_IN_PRODUCTION, sCNSTR, sES, sLINE_SEP |
Constructor Summary | |
MFDate()
Create a MFDate with the default SimpleDateFormat. |
|
MFDate(SimpleDateFormat sd_format)
Create a MFDate. |
|
MFDate(SimpleDateFormat sd_format,
String s_indent)
Create a MFDate. |
|
MFDate(SimpleDateFormat sd_format,
String s_indent,
boolean b_indentAfterDate)
Create a MFDate. |
Method Summary | |
String |
getDateStamp()
Get the date prefix as a string. |
String |
getFormatted(boolean b_useIndent,
String s_message)
Get the formatted message. |
SimpleDateFormat |
getSimpleDateFormat()
Get the SimpleDateFormat for direct manipulation. |
boolean |
isIndentAfterDate()
Will the indent be printed after or before the date stamp? |
void |
setIndentAfterDate(boolean b_indentAfterDate)
Declare if the indent should go after the date stamp, or before. |
Methods inherited from class xbn.output.MsgFormat |
getIndent, hasIndent, setIndent, toString |
Methods inherited from class xbn.XBNObject |
getXMsgPrefix, sop, sopl, sopl, throwAX, throwAXIfBadStr, throwAXIfNull, throwAXSpoof |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public MFDate()
Create a MFDate with the default SimpleDateFormat.
Equal to MFPlain(new SimpleDateFormat("MM-dd-yyyy HH:mm:ss "))
public MFDate(SimpleDateFormat sd_format)
Create a MFDate.
Equal to MFPlain(sd_format, null)
public MFDate(SimpleDateFormat sd_format, String s_indent)
Create a MFDate.
Equal to MFPlain(sd_format, s_indent, true)
public MFDate(SimpleDateFormat sd_format, String s_indent, boolean b_indentAfterDate)
Create a MFDate.
sd_format
- The SimpleDateFormat object. See the documentation at the top of this page for an example. May not be null.s_indent
- Passed directly to MsgFormat constructor.b_indentAfterDate
- Should the indent text be put before or after the date stamp? It looks cooler when after.Method Detail |
public String getFormatted(boolean b_useIndent, String s_message)
Get the formatted message.
getFormatted
in class MsgFormat
getDateStamp() + getIndent() + s_message
getIndent() + getDateStamp() + s_message
getDateStamp() + s_message
public final void setIndentAfterDate(boolean b_indentAfterDate)
Declare if the indent should go after the date stamp, or before.
b_indentAfterDate
- If true, then the indent text (if hasIndent equals true) will be printed after the date stamp. If false, the indent text will be printed before the date stamp.public boolean isIndentAfterDate()
Will the indent be printed after or before the date stamp?
public String getDateStamp()
Get the date prefix as a string.
getSimpleDateFormat().format(new Date())
public SimpleDateFormat getSimpleDateFormat()
Get the SimpleDateFormat for direct manipulation.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright 1997-2003, Jeff Epstein, All Rights Reserved. See top of source code files for copyright notice.
http://sourceforge.net/projects/xbnjava