Class SyslogTimeStamp

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable

    public class SyslogTimeStamp
    extends java.text.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

        java.text.Format.Field
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String DEFAULT_GMT_TZID
      Constant DEFAULT_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
      java.lang.StringBuffer format​(java.lang.Object date, java.lang.StringBuffer appendTo, java.text.FieldPosition fieldPos)
      java.lang.String format​(java.util.Date date)
      format
      java.lang.String formatTimeZone​(java.util.Date date, java.util.TimeZone tz)
      formatTimeZone
      static SyslogTimeStamp getInstance()
      getInstance
      java.util.Date parse​(java.lang.String source)
      parse
      java.lang.Object parseObject​(java.lang.String source, java.text.ParsePosition pos)
      java.util.Date parseTimestamp​(java.lang.String source)
      parseTimestamp
      • Methods inherited from class java.text.Format

        clone, format, formatToCharacterIterator, parseObject
      • Methods inherited from class java.lang.Object

        equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • DEFAULT_GMT_TZID

        public static final java.lang.String DEFAULT_GMT_TZID
        Constant DEFAULT_GMT_TZID="GMT+00"
        See Also:
        Constant Field Values
    • Constructor Detail

      • SyslogTimeStamp

        public SyslogTimeStamp()
    • Method Detail

      • format

        public java.lang.String format​(java.util.Date date)
                                throws java.lang.IllegalArgumentException

        format

        Parameters:
        date - a Date object.
        Returns:
        a String object.
        Throws:
        java.lang.IllegalArgumentException - if any.
      • formatTimeZone

        public java.lang.String formatTimeZone​(java.util.Date date,
                                               java.util.TimeZone tz)
                                        throws java.lang.IllegalArgumentException

        formatTimeZone

        Parameters:
        date - a Date object.
        tz - a TimeZone object.
        Returns:
        a String object.
        Throws:
        java.lang.IllegalArgumentException - if any.
      • format

        public java.lang.StringBuffer format​(java.lang.Object date,
                                             java.lang.StringBuffer appendTo,
                                             java.text.FieldPosition fieldPos)
                                      throws java.lang.IllegalArgumentException
        Specified by:
        format in class java.text.Format
        Throws:
        java.lang.IllegalArgumentException
      • parse

        public java.util.Date parse​(java.lang.String source)
                             throws java.text.ParseException

        parse

        Parameters:
        source - a String object.
        Returns:
        a Date object.
        Throws:
        java.text.ParseException - if any.
      • parseObject

        public java.lang.Object parseObject​(java.lang.String source,
                                            java.text.ParsePosition pos)
        Specified by:
        parseObject in class java.text.Format
      • parseTimestamp

        public java.util.Date parseTimestamp​(java.lang.String source)
                                      throws java.text.ParseException

        parseTimestamp

        Parameters:
        source - a String object.
        Returns:
        a Date object.
        Throws:
        java.text.ParseException - if any.