|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectpasn.ASN1Object
pasn.ASN1SimpleObject<ASN1TimeValue>
pasn.ASN1Time
public abstract class ASN1Time
Generic class that manipulates ASN.1 time objects common operations
Constructor Summary | |
---|---|
ASN1Time(int type,
boolean shortYear)
|
Method Summary | |
---|---|
ASN1TimeValue |
createValue()
|
static ASN1Time |
getAppropriateTime()
Returns either an UTC time or a Generalized time depending on date constraints. |
static ASN1Time |
getAppropriateTime(java.util.Date value)
Returns either an UTC time or a Generalized time depending on date constraints. |
static ASN1Time |
getAppropriateTime(java.lang.String value)
Given a string representation of a time value, returns the appropriate ASN.1 time object depending on the number of digits used to express the given value |
ASN1TimeFormat |
getTimeFormat()
|
boolean |
hasDefaultValue()
|
boolean |
hasValue()
Indicates whether this TIME object is initialized with a time value or not |
boolean |
isTimeValidated()
|
boolean |
isValueDefault()
|
void |
reset()
Resets this ASN.1 time object. |
void |
setDecodedValue(java.lang.Object value)
|
void |
setTimeFormat(ASN1TimeFormat tf)
|
void |
setTimeValidation(boolean validate)
|
void |
setValue()
|
abstract void |
setValue(java.lang.String value)
Initializes this ASN.1 time object with a string representation of a date and time |
java.lang.String |
toString()
Expresses this time object as a string, according to the current time format (default format is ASN1TimeFormat.FORMAT_0 ) |
java.lang.String |
toString(ASN1TimeFormat format)
|
void |
validateConstraints(ASN1TimeValue value)
|
Methods inherited from class pasn.ASN1SimpleObject |
---|
equals, getDefaultValue, getValue, getValueOrDefault, hasValueOrDefault, setDefaultValue, setValue |
Methods inherited from class pasn.ASN1Object |
---|
getAsnClass, getSpecificEncoding, getSpecificEncoding, getType, hasSpecificEncodings, setSpecificEncoding |
Methods inherited from class java.lang.Object |
---|
getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface pasn.ASN1GenericObject |
---|
getASN1Name, getAsnClass, getType |
Methods inherited from interface pasn.ASN1EncodingSpecificObject |
---|
getSpecificEncoding, hasSpecificEncodings |
Constructor Detail |
---|
public ASN1Time(int type, boolean shortYear)
Method Detail |
---|
public final void setTimeValidation(boolean validate)
public boolean isTimeValidated()
public final boolean isValueDefault()
public static final ASN1Time getAppropriateTime() throws ASN1ConstraintException
Returns either an UTC time or a Generalized time depending on date constraints. The enclosed date value corresponds to the current date and time. Indeed, UTC time should not be used to manipulate dates prior to 1949 or later than 2049. It is commonly adopted that other date values sould be represented by generalized times
ASN1ConstraintException
public static final ASN1Time getAppropriateTime(java.util.Date value) throws ASN1ConstraintException
Returns either an UTC time or a Generalized time depending on date constraints. Indeed, UTC time should not be used to manipulate dates prior to 1949 or later than 2049. It is commonly accepted that other dates sould be represented by generalized times
value
- Any date. A null date is considered as the
current date
ASN1ConstraintException
public static final ASN1Time getAppropriateTime(java.lang.String value) throws ASN1FormatException, ASN1ConstraintException
Given a string representation of a time value, returns the appropriate ASN.1 time object depending on the number of digits used to express the given value
value
- A string representation of a time value. This value must
conform to one of the available representation formats
ASN1FormatException
ASN1ConstraintException
- The given value does not represent a
valid time value or does not conform to the supported time formatspublic final void validateConstraints(ASN1TimeValue value) throws ASN1ConstraintException
ASN1ConstraintException
public final boolean hasValue()
Indicates whether this TIME object is initialized with a time value or not
reset()
for examplepublic final boolean hasDefaultValue()
public void reset()
Resets this ASN.1 time object. Note that this operation does not initialize the current time zone to its default value ("GMT+0000") nor the current time format.
Any call to hasValue()
returns false
public final ASN1TimeValue createValue()
public final void setValue()
public final void setTimeFormat(ASN1TimeFormat tf)
public final ASN1TimeFormat getTimeFormat()
public final void setDecodedValue(java.lang.Object value) throws ASN1FormatException, ASN1ConstraintException
ASN1FormatException
ASN1ConstraintException
public abstract void setValue(java.lang.String value) throws ASN1FormatException, ASN1ConstraintException
value
- A time value. A null or empty ("") value leads to
assign the current time value using local time zone
ASN1FormatException
- The given value does not correspond to a
valid time representation
ASN1ConstraintException
public final java.lang.String toString(ASN1TimeFormat format)
public final java.lang.String toString()
ASN1TimeFormat.FORMAT_0
)
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |