codec.asn1
Class ASN1GeneralizedTime

java.lang.Object
  |
  +--codec.asn1.ASN1AbstractType
        |
        +--codec.asn1.ASN1AbstractString
              |
              +--codec.asn1.ASN1VisibleString
                    |
                    +--codec.asn1.ASN1Time
                          |
                          +--codec.asn1.ASN1GeneralizedTime
All Implemented Interfaces:
ASN1String, ASN1Type, Cloneable, Externalizable, Serializable

public class ASN1GeneralizedTime
extends ASN1Time

This is the Generalized Time class. In principle, the known time types are all of type VisibleString. GeneralizedTime is defined as [UNIVERSAL 24] IMPLICIT VisibleString . This class automatically represents dates internally in a DER compliant format, and parses dates according to BER. The internal representation is not changed from BER to DER on decoding. This is to ensure that decoding and encoding restore bitwise identical encodings.

Version:
"$Id: ASN1GeneralizedTime.java,v 1.13 2004/09/20 15:16:30 pebinger Exp $"
Author:
Volker Roth
See Also:
Serialized Form

Fields inherited from class codec.asn1.ASN1Time
date_, ZEROES
 
Constructor Summary
ASN1GeneralizedTime()
          Creates an instance.
ASN1GeneralizedTime(Calendar cal)
          Creates an instance with the given date.
ASN1GeneralizedTime(Date date)
          Creates an instance with the given date.
ASN1GeneralizedTime(long time)
          Creates an instance with the given number of milliseconds since January 1, 1970, 00:00:00 GMT.
ASN1GeneralizedTime(String time)
          Creates an instance with the given date string.
 
Method Summary
protected  int[] getFieldCorrections()
           
protected  int[] getFieldLengths()
           
protected  int[] getFields()
           
 int getTag()
          Returns the corresponding ASN.1 tag.
 
Methods inherited from class codec.asn1.ASN1Time
decode, encode, getDate, getTime, setDate, setDate, setDate, setDate, setString, toDate, toString
 
Methods inherited from class codec.asn1.ASN1AbstractString
convert, convert, convertedLength, equals, getString, getValue, hashCode, setString0, toString
 
Methods inherited from class codec.asn1.ASN1AbstractType
checkConstraints, getConstraint, getTagClass, isExplicit, isOptional, isType, readExternal, setConstraint, setExplicit, setOptional, writeExternal
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface codec.asn1.ASN1Type
checkConstraints, getConstraint, getTagClass, isExplicit, isOptional, isType, setConstraint, setExplicit, setOptional
 

Constructor Detail

ASN1GeneralizedTime

public ASN1GeneralizedTime()
Creates an instance. The value of this instance is set to the current date.

ASN1GeneralizedTime

public ASN1GeneralizedTime(String time)
Creates an instance with the given date string. The date string must be well-formed according to the BER.
Parameters:
time - The string representation of the date.
Throws:
IllegalArgumentException - if the given string has a bad format.
StringIndexOutOfBoundsException - if the string is not well-formed.

ASN1GeneralizedTime

public ASN1GeneralizedTime(Calendar cal)
Creates an instance with the given date.
Parameters:
cal - The Calendar.

ASN1GeneralizedTime

public ASN1GeneralizedTime(Date date)
Creates an instance with the given date.
Parameters:
date - The date.

ASN1GeneralizedTime

public ASN1GeneralizedTime(long time)
Creates an instance with the given number of milliseconds since January 1, 1970, 00:00:00 GMT.
Parameters:
time - The time.
Method Detail

getFields

protected int[] getFields()
Overrides:
getFields in class ASN1Time

getFieldLengths

protected int[] getFieldLengths()
Overrides:
getFieldLengths in class ASN1Time

getFieldCorrections

protected int[] getFieldCorrections()
Overrides:
getFieldCorrections in class ASN1Time

getTag

public int getTag()
Description copied from class: ASN1AbstractType
Returns the corresponding ASN.1 tag.
Overrides:
getTag in class ASN1VisibleString
Following copied from class: codec.asn1.ASN1AbstractType
Returns:
the corresponding ASN.1 tag


Copyright © Fraunhofer Gesellschaft. All Rights Reserved.