Package org.opennms.netmgt.syslogd
Class SyslogTimeStamp
- java.lang.Object
-
- java.text.Format
-
- org.opennms.netmgt.syslogd.SyslogTimeStamp
-
- All Implemented Interfaces:
Serializable,Cloneable
public class SyslogTimeStamp extends Format
The TimestampFormat class implements the code necessary to format and parse syslog timestamps, which come in the flavor of 'Sep 14 15:43:06'.- Author:
- Timothy Gerard Endres, time@ice.com.
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class java.text.Format
Format.Field
-
-
Field Summary
Fields Modifier and Type Field Description static StringDEFAULT_GMT_TZIDConstantDEFAULT_GMT_TZID="GMT+00"
-
Constructor Summary
Constructors Constructor Description SyslogTimeStamp()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description StringBufferformat(Object date, StringBuffer appendTo, FieldPosition fieldPos)Stringformat(Date date)formatStringformatTimeZone(Date date, TimeZone tz)formatTimeZonestatic SyslogTimeStampgetInstance()getInstanceDateparse(String source)parseObjectparseObject(String source, ParsePosition pos)DateparseTimestamp(String source)parseTimestamp-
Methods inherited from class java.text.Format
clone, format, formatToCharacterIterator, parseObject
-
-
-
-
Field Detail
-
DEFAULT_GMT_TZID
public static final String DEFAULT_GMT_TZID
ConstantDEFAULT_GMT_TZID="GMT+00"- See Also:
- Constant Field Values
-
-
Method Detail
-
getInstance
public static final SyslogTimeStamp getInstance()
getInstance
- Returns:
- a
SyslogTimeStampobject.
-
format
public String format(Date date) throws IllegalArgumentException
format
- Parameters:
date- aDateobject.- Returns:
- a
Stringobject. - Throws:
IllegalArgumentException- if any.
-
formatTimeZone
public String formatTimeZone(Date date, TimeZone tz) throws IllegalArgumentException
formatTimeZone
- Parameters:
date- aDateobject.tz- aTimeZoneobject.- Returns:
- a
Stringobject. - Throws:
IllegalArgumentException- if any.
-
format
public StringBuffer format(Object date, StringBuffer appendTo, FieldPosition fieldPos) throws IllegalArgumentException
- Specified by:
formatin classFormat- Throws:
IllegalArgumentException
-
parse
public Date parse(String source) throws ParseException
parse
- Parameters:
source- aStringobject.- Returns:
- a
Dateobject. - Throws:
ParseException- if any.
-
parseObject
public Object parseObject(String source, ParsePosition pos)
- Specified by:
parseObjectin classFormat
-
parseTimestamp
public Date parseTimestamp(String source) throws ParseException
parseTimestamp
- Parameters:
source- aStringobject.- Returns:
- a
Dateobject. - Throws:
ParseException- if any.
-
-