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 String
DEFAULT_GMT_TZID
ConstantDEFAULT_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 StringBuffer
format(Object date, StringBuffer appendTo, FieldPosition fieldPos)
String
format(Date date)
formatString
formatTimeZone(Date date, TimeZone tz)
formatTimeZonestatic SyslogTimeStamp
getInstance()
getInstanceDate
parse(String source)
parseObject
parseObject(String source, ParsePosition pos)
Date
parseTimestamp(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
SyslogTimeStamp
object.
-
format
public String format(Date date) throws IllegalArgumentException
format
- Parameters:
date
- aDate
object.- Returns:
- a
String
object. - Throws:
IllegalArgumentException
- if any.
-
formatTimeZone
public String formatTimeZone(Date date, TimeZone tz) throws IllegalArgumentException
formatTimeZone
- Parameters:
date
- aDate
object.tz
- aTimeZone
object.- Returns:
- a
String
object. - Throws:
IllegalArgumentException
- if any.
-
format
public StringBuffer format(Object date, StringBuffer appendTo, FieldPosition fieldPos) throws IllegalArgumentException
- Specified by:
format
in classFormat
- Throws:
IllegalArgumentException
-
parse
public Date parse(String source) throws ParseException
parse
- Parameters:
source
- aString
object.- Returns:
- a
Date
object. - Throws:
ParseException
- if any.
-
parseObject
public Object parseObject(String source, ParsePosition pos)
- Specified by:
parseObject
in classFormat
-
parseTimestamp
public Date parseTimestamp(String source) throws ParseException
parseTimestamp
- Parameters:
source
- aString
object.- Returns:
- a
Date
object. - Throws:
ParseException
- if any.
-
-