Package com.oss.asn1
Class UTCTime
java.lang.Object
com.oss.asn1.AbstractData
com.oss.asn1.AbstractTime
com.oss.asn1.UTCTime
- All Implemented Interfaces:
Serializable
,Cloneable
The UTCTime class represents the ASN.1 UTCTime type
- Since:
- ASN.1/Java 1.0-beta A
- See Also:
-
Field Summary
Fields inherited from class com.oss.asn1.AbstractData
EQUALS, GREATER_THAN, LESS_THAN
-
Constructor Summary
ConstructorsConstructorDescriptionUTCTime()
The default constructor.UTCTime
(int[] components) Construct an instance of this class from an int array.UTCTime
(int year, int month, int day, int hour, int minute, int second, int minDiff) Construct from individual time components.Construct an instance of this class from a String containing value notation of the UTCTime. -
Method Summary
Modifier and TypeMethodDescriptionfinal int
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.final int
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.final boolean
Compare 'this' object to another UTCTime object to see if their contents are the same.void
Set an instance of this class from a String containing value notation of the UTCTime.Methods inherited from class com.oss.asn1.AbstractTime
getDay, getHour, getMinute, getMinuteDifferential, getMonth, getSecond, getYear, hashCode, intArrayValue, setDay, setHour, setMinute, setMinuteDifferential, setMonth, setSecond, setValue, setYear, toDate, toDate
Methods inherited from class com.oss.asn1.AbstractData
clone, delete, equals, isEncodable, isPDU, isValid, toString, toString
-
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.- Parameters:
year
- the year to set.month
- the month to set.day
- the day to set.hour
- the hour to set.minute
- the minute to sey.second
- the second to set.minDiff
- the minute-differential to set.
-
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
Construct an instance of this class from a String containing value notation of the UTCTime.- Parameters:
value
- string containing GeneralizedTime value.- Throws:
BadTimeFormatException
- ifvalue
has invalid format- See Also:
-
-
Method Details
-
setValue
Set an instance of this class from a String containing value notation of the UTCTime. The value notation has the following format:YYMMDDHHMMSS+hhmm
orYYMMDDHHMMSS-hhmm
orYYMMDDHHMMSSZ
YY
is a two-digit year, andMM
,DD
,HH
,MM
andSS
mean month, day, hour, minute and second. The string ends either withZ
, which means that the value is UTC time, or with time differential.hh
mean hour difference andmm
means minute differential.- Parameters:
value
- string containing UTCTime value.- Throws:
BadTimeFormatException
- ifvalue
has invalid format
-
equalTo
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
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
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.
-