Package com.oss.asn1

Class UTCTime

All Implemented Interfaces:
Serializable, Cloneable

public class UTCTime extends AbstractTime
The UTCTime class represents the ASN.1 UTCTime type
Since:
ASN.1/Java 1.0-beta A
See Also:
  • Constructor Details

    • UTCTime

      public UTCTime()
      The default constructor.
    • UTCTime

      public UTCTime(int year, int month, int day, int hour, int minute, int second, int minDiff)
      Construct from individual time components.
    • UTCTime

      public UTCTime(int[] components)
      Construct an instance of this class from an int array. The int array contains the time components in the order: year, month, day, hour, minute, second, minute-differential.
      Parameters:
      components - an int array of time components.
    • UTCTime

      public UTCTime(String value) throws BadTimeFormatException
      Construct an instance of this class from a String containing value notation of the UTCTime.
      Parameters:
      value - string containing GeneralizedTime value.
      Throws:
      BadTimeFormatException - if value has invalid format
      See Also:
  • Method Details

    • setValue

      public void setValue(String value) throws BadTimeFormatException
      Set an instance of this class from a String containing value notation of the UTCTime. The value notation has the following format:
                 YYMMDDHHMMSS+hhmm
             or
                 YYMMDDHHMMSS-hhmm
             or
                 YYMMDDHHMMSSZ
             
             where YY is a two-digit year, and MM,
             DD, HH, MM and SS
             mean month, day, hour, minute and second. The string ends either with
             Z, which means that the value is UTC time, or with time
             differential. hh mean hour difference and mm
             means minute differential.
      Parameters:
      value - string containing UTCTime value.
      Throws:
      BadTimeFormatException - if value has invalid format
    • equalTo

      public final boolean equalTo(UTCTime that)
      Compare 'this' object to another UTCTime object to see if their contents are the same.
      Parameters:
      that - the UTCTime object to compare 'this' object to.
      Returns:
      true if contents of both objects are the same. comparison.
      Throws:
      NullPointerException - thrown when 'that' is null.
    • compareTo

      public final int compareTo(UTCTime that)
      Compare 'this' object to another UTCTime object to determine whether the contents of this object is less than, equal to, or greater than the contents of other object.
      Parameters:
      that - the UTCTime object to compare 'this' object to.
      Returns:
      LESS_THAN, EQUALS, GREATER_THAN values as the results of comparison.
      Throws:
      NullPointerException - thrown when 'that' is null.
    • compareTo

      public final int compareTo(UTCTime that, TimeZone zone, Locale locale)
      Compare 'this' object to another object of the same class to determine whether the contents of this object is less than, equal to, or greater than the contents of other object.
      Parameters:
      that - the UTCTime object to compare 'this' object to.
      zone - the TimeZone object to use during comparison.
      locale - the Locale object to use during comparison.
      Returns:
      LESS_THAN, EQUALS, GREATER_THAN values as the results of comparison.
      Throws:
      NullPointerException - thrown when 'that' is null.