com.objsys.asn1j.runtime
Class Asn1Time

java.lang.Object
  extended by com.objsys.asn1j.runtime.Asn1Type
      extended by com.objsys.asn1j.runtime.Asn1CharString
          extended by com.objsys.asn1j.runtime.Asn18BitCharString
              extended by com.objsys.asn1j.runtime.Asn1Time
All Implemented Interfaces:
Asn1TypeIF, java.io.Serializable, java.lang.Cloneable, java.lang.Comparable
Direct Known Subclasses:
Asn1GeneralizedTime, Asn1UTCTime

public abstract class Asn1Time
extends Asn18BitCharString
implements java.lang.Comparable

This is a base class for holding the components of an ASN.1 generalized and universal times string value.

See Also:
Serialized Form

Field Summary
static int Apr
           
static int April
           
static int Aug
           
static int August
           
protected  int day
          Day of month component.
static int Dec
           
static int December
           
protected  boolean derRules
          Indicates DER is used (or CER/PER).
protected  int diffHour
          Zone offset's hour component.
protected  int diffMin
          Zone offset's minute component.
static int Feb
           
static int February
           
protected  int hour
          Hour component.
static int Jan
           
static int January
           
static int Jul
           
static int July
           
static int Jun
           
static int June
           
static int Mar
           
static int March
           
static int May
           
protected  int minute
          Minute component.
protected  int month
          Month component.
static int Nov
           
static int November
           
static int Oct
           
static int October
           
protected  boolean parsed
          Indicates string parsed or not.
protected  java.lang.String secFraction
          Second's fraction component.
protected  int second
          Second component.
static int Sep
           
static int September
           
protected  boolean utcFlag
          Indicates UTC flag ('Z') set or not.
protected  int year
          Year component.
 
Fields inherited from class com.objsys.asn1j.runtime.Asn18BitCharString
BITSPERCHAR_A, BITSPERCHAR_U
 
Fields inherited from class com.objsys.asn1j.runtime.Asn1CharString
mStringBuffer, value
 
Fields inherited from class com.objsys.asn1j.runtime.Asn1Type
BIT_STRING, BMPString, BOOLEAN, DATE, DATE_TIME, DURATION, ENUMERATED, EOC, EXTERNAL, GeneralString, GeneralTime, GraphicString, IA5String, INTEGER, NULL, NumericString, OBJECT_IDENTIFIER, ObjectDescriptor, OCTET_STRING, OID_IRI, OpenType, PrintableString, REAL, RELATIVE_OID_IRI, RelativeOID, SEQUENCE, SET, T61String, TeletexString, TIME, TIME_OF_DAY, UniversalString, UTCTime, UTF8String, VideotexString, VisibleString
 
Constructor Summary
Asn1Time(short typeCode, boolean useDerRules)
          This constructor creates an empty time string object.
Asn1Time(java.lang.String data, short typeCode, boolean useDerRules)
          This constructor creates a time string using data String.
 
Method Summary
protected static char charAt(java.lang.String s, int index)
          Returns the character at the specified index in the specified string.
 void clear()
          This method clears time string.
 int compareTo(java.lang.Object other)
          This method compares this object with Asn1Time class instance or with Calendar instance.
protected abstract  boolean compileString()
          Compiles new time string accoring X.680 (clauses 41, 42) and ISO 8601.
protected  void decode(Asn1BerDecodeBuffer buffer, boolean explicit, int implicitLength, Asn1Tag tag)
          This method decodes an ASN.1 character string value including the UNIVERSAL tag value and length if explicit tagging is specified.
 void decode(Asn1PerDecodeBuffer buffer)
          This method is the base implementation of the standard Packed Encoding Rules (PER) decode method.
 void decodeXML(java.lang.String buffer, java.lang.String attrs)
          This method decodes ASN.1 GeneralizedTime type, using the XML schema encoding rules.
protected  int encode(Asn1BerEncodeBuffer buffer, boolean explicit, Asn1Tag tag)
          This method encodes ASN.1 time string type.
 void encode(Asn1BerOutputStream out, boolean explicit, Asn1Tag tag)
          This method encodes and writes to the stream an ASN.1 time string value including the UNIVERSAL tag value and length if explicit tagging is specified.
 void encode(Asn1PerEncodeBuffer buffer)
          This method is the base implementation of the standard Packed Encoding Rules (PER) encode method.
 void encode(Asn1PerOutputStream out)
          This method encodes and writes to stream an ASN.1 time string value using the standard Packed Encoding Rules (PER) encode method.
 void encode(Asn1XmlEncoder buffer, java.lang.String elemName, java.lang.String nsPrefix)
          This method encodes this ASN.1 time into xsd:dateTime format with element and attribute name tag according to the XML Encoding as specified in the XML schema standard(asn2xsd).
 void encodeXER(Asn1XmlEncoder buffer, java.lang.String elemName, java.lang.String nsPrefix)
          This method encodes this ASN.1 time according to XER encoding rules.
 void encodeXMLData(Asn1XmlXerEncoder buffer)
          This method encodes this ASN.1 time string into xsd:dateTime format.
 boolean equals(java.lang.Object other)
          This method compares this object with Asn1Time class instance or with Calendar instance.
abstract  boolean equals(java.lang.String s)
          This method compares this object with a String value.
 int getDay()
          This method returns the day of month number component of the time value.
 int getDiff()
          This method returns the difference between the time zone of the object and Coordinated Universal Time (UTC), in minutes.
 int getDiffHour()
          This method returns the hour component of the difference between the time zone of the object and Coordinated Universal Time (UTC).
 int getDiffMinute()
          This method returns the minute component of the difference between the time zone of the object and Coordinated Universal Time (UTC).
 java.lang.String getFraction()
          This method returns the second's decimal fraction component of the time value.
 int getHour()
          This method returns the hour component of the time value.
 int getMinute()
          This method returns the minute component of the time value.
 int getMonth()
          This method returns the month number component of the time value.
 int getSecond()
          This method returns the second component of the time value.
 java.util.Calendar getTime()
          This method converts the time string to the java.util.Calendar value.
 boolean getUTC()
          This method returns the UTC flag state.
 int getYear()
          This method returns the year component of the time value.
protected  void init()
           
protected static int parseInt(java.lang.String str, IntHolder off, int len)
          Parses integer value using String.
abstract  void parseString(java.lang.String string)
          This method parses passed time string.
 void parseXmlString(java.lang.String string)
          This method parses the given time string value.
protected  void putInteger(int width, int value)
          Puts integer in string buffer
static void putInteger(java.lang.StringBuffer data, int width, int value)
          Puts integer in string buffer
protected  void safeParseString()
           
 void setDay(int day)
          This method sets the day of month number component of the time value.
 void setDER(boolean bvalue)
           
 void setDiff(int inMinutes)
          This method sets the difference between the time zone of the object and Coordinated Universal Time (UTC), in minutes.
 void setDiff(int dhour, int dminute)
          This method sets the hour and minute components of the difference between the time zone of the object and Coordinated Universal Time (UTC).
 void setDiffHour(int dhour)
          This method sets the hour component of the difference between the time zone of the object and Coordinated Universal Time (UTC).
 void setFraction(java.lang.String fraction)
          This method sets the second's decimal fraction component of the time value.
 void setHour(int hour)
          This method sets the hour component of the time value.
 void setMinute(int minute)
          This method sets the minute component of the time value.
 void setMonth(int month)
          This method sets the month number component of the time value.
 void setSecond(int second)
          This method sets the second component of the time value.
 void setTime(java.util.Calendar time)
          This method converts the java.util.Calendar value to time string.
 void setUTC(boolean utc)
          This method sets the UTC flag state.
 void setYear(int year)
          This method sets the year component of the time value.
 
Methods inherited from class com.objsys.asn1j.runtime.Asn18BitCharString
decode, decode, encode, encode, encode, encode
 
Methods inherited from class com.objsys.asn1j.runtime.Asn1CharString
decode, decode, decode, decodeXER, encode, encode, encode, encode, getLength, hashCode, toString, validate
 
Methods inherited from class com.objsys.asn1j.runtime.Asn1Type
clone, decode, decode, decode, decode, decode, decode, encode, encode, encode, encode, equals, getTypeName, indent, isOpenType, matchTag, matchTag, pdiag, print, setKey, setOpenType
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

year

protected transient int year
Year component. Legal interval is 0..9999.


month

protected transient int month
Month component. Legal interval is 1..12.


day

protected transient int day
Day of month component. Legal interval is 1..31.


hour

protected transient int hour
Hour component. Legal interval is 0..23.


minute

protected transient int minute
Minute component. Legal interval is 0..59.


second

protected transient int second
Second component. Legal interval is 0..59.


secFraction

protected transient java.lang.String secFraction
Second's fraction component. Legal interval is 0..INF.


diffHour

protected transient int diffHour
Zone offset's hour component. Legal interval is -12..+12.


diffMin

protected transient int diffMin
Zone offset's minute component. Legal interval is -59..+59.


utcFlag

protected transient boolean utcFlag
Indicates UTC flag ('Z') set or not.


parsed

protected transient boolean parsed
Indicates string parsed or not.


derRules

protected transient boolean derRules
Indicates DER is used (or CER/PER).


January

public static final int January
See Also:
Constant Field Values

Jan

public static final int Jan
See Also:
Constant Field Values

February

public static final int February
See Also:
Constant Field Values

Feb

public static final int Feb
See Also:
Constant Field Values

March

public static final int March
See Also:
Constant Field Values

Mar

public static final int Mar
See Also:
Constant Field Values

April

public static final int April
See Also:
Constant Field Values

Apr

public static final int Apr
See Also:
Constant Field Values

May

public static final int May
See Also:
Constant Field Values

June

public static final int June
See Also:
Constant Field Values

Jun

public static final int Jun
See Also:
Constant Field Values

July

public static final int July
See Also:
Constant Field Values

Jul

public static final int Jul
See Also:
Constant Field Values

August

public static final int August
See Also:
Constant Field Values

Aug

public static final int Aug
See Also:
Constant Field Values

September

public static final int September
See Also:
Constant Field Values

Sep

public static final int Sep
See Also:
Constant Field Values

October

public static final int October
See Also:
Constant Field Values

Oct

public static final int Oct
See Also:
Constant Field Values

November

public static final int November
See Also:
Constant Field Values

Nov

public static final int Nov
See Also:
Constant Field Values

December

public static final int December
See Also:
Constant Field Values

Dec

public static final int Dec
See Also:
Constant Field Values
Constructor Detail

Asn1Time

public Asn1Time(short typeCode,
                boolean useDerRules)
This constructor creates an empty time string object.

Parameters:
typeCode - Integer constant from Asn1Type class (Asn1Type.GeneralTime or Asn1Type.UTCTime).
useDerRules - 'true' if time string should be encoded with DER/PER.

Asn1Time

public Asn1Time(java.lang.String data,
                short typeCode,
                boolean useDerRules)
This constructor creates a time string using data String.

Parameters:
typeCode - Integer constant from Asn1Type class (Asn1Type.GeneralTime or Asn1Type.UTCTime).
useDerRules - 'true' if time string should be encoded with DER/PER.
Method Detail

init

protected void init()

getYear

public int getYear()
            throws Asn1Exception
This method returns the year component of the time value. Note that the return value may differentiate for different inherited Asn1Time classes.

Returns:
Year component (full 4 digits) is returned if the operation is successful.
Throws:
Asn1Exception - Thrown, if operation is failed.

getMonth

public int getMonth()
             throws Asn1Exception
This method returns the month number component of the time value. The number of January is 1, February - 2, December - 12. You may use enumerating values for months decoding: Asn1Time.January, Asn1Time.February, etc. Also you can use short aliases for months: Asn1Time.Jan, Asn1Time.Feb, etc. Note that the return value may differentiate for different inherited Asn1Time classes.

Returns:
Month component (1..12) is returned if the operation is successful.
Throws:
Asn1Exception - Thrown, if operation is failed.

getDay

public int getDay()
           throws Asn1Exception
This method returns the day of month number component of the time value. The number of the first day in month is 1, the number of the last day may be in interval from 28 to 31. Note that the return value may differentiate for different inherited Asn1Time classes.

Returns:
Day of month component (1..31) is returned if the operation is successful.
Throws:
Asn1Exception - Thrown, if operation is failed.

getHour

public int getHour()
            throws Asn1Exception
This method returns the hour component of the time value. As the ISO 8601 is based on the 24-hour timekeeping system, two digits represent hours from 00 to 23. Note that the return value may differentiate for different inherited Asn1Time classes.

Returns:
Hour component (0..23) is returned if the operation is successful.
Throws:
Asn1Exception - Thrown, if operation is failed.

getMinute

public int getMinute()
              throws Asn1Exception
This method returns the minute component of the time value. Minutes are represented by two digits from 00 to 59. Note that the return value may differentiate for different inherited Asn1Time classes.

Returns:
Minute component (0..59) is returned if the operation is successful.
Throws:
Asn1Exception - Thrown, if operation is failed.

getSecond

public int getSecond()
              throws Asn1Exception
This method returns the second component of the time value. Seconds are represented by two digits from 00 to 59. Note that the return value may differentiate for different inherited Asn1Time classes.

Returns:
Second component (0..59) is returned if the operation is successful.
Throws:
Asn1Exception - Thrown, if operation is failed.

getFraction

public java.lang.String getFraction()
                             throws Asn1Exception
This method returns the second's decimal fraction component of the time value. Second's decimal fraction is represented by from 0 to infinite value. Note that the return value may differentiate for different inherited Asn1Time classes.

Returns:
Second's decimal fraction component is returned if the operation is successful.
Throws:
Asn1Exception - Thrown, if operation is failed.

getDiffHour

public int getDiffHour()
                throws Asn1Exception
This method returns the hour component of the difference between the time zone of the object and Coordinated Universal Time (UTC). The UTC time is the sum of the local time and positive or negative time difference. Note that the return value may differentiate for different inherited Asn1Time classes.

Returns:
The negative or positive hour component of the difference between the time zone of the object and UTC time (-12..+12) is returned if the operation is successful.
Throws:
Asn1Exception - Thrown, if operation is failed.

getDiffMinute

public int getDiffMinute()
                  throws Asn1Exception
This method returns the minute component of the difference between the time zone of the object and Coordinated Universal Time (UTC). The UTC time is the sum of the local time and positive or negative time difference. Note that the return value may differentiate for different inherited Asn1Time classes.

Returns:
The negative or positive minute component of the difference between the time zone of the object and UTC time (-59..+59) is returned if the operation is successful.
Throws:
Asn1Exception - Thrown, if operation is failed.

getDiff

public int getDiff()
            throws Asn1Exception
This method returns the difference between the time zone of the object and Coordinated Universal Time (UTC), in minutes. The UTC time is the sum of the local time and positive or negative time difference. Note that the return value may differentiate for different inherited Asn1Time classes.

Returns:
The negative or positive difference, in minutes, between the time zone of the object and UTC time (-12*60..+12*60) is returned if the operation is successful.
Throws:
Asn1Exception - Thrown, if operation is failed.

getUTC

public boolean getUTC()
               throws Asn1Exception
This method returns the UTC flag state. If the UTC flag is true, then the time is an UTC time and symbol 'Z' is added at the end of time string. Otherwise, it is a local time.

Returns:
UTC flag state is returned.
Throws:
Asn1Exception - Thrown, if operation is failed.

getTime

public java.util.Calendar getTime()
                           throws Asn1Exception
This method converts the time string to the java.util.Calendar value. If time represented as UTC time plus or minus difference time, then the result Calendar will contain ZONE_OFFSET field. Note that the return value may differentiate for different inherited Asn1Time classes. The returned value will be a non-lenient object of Calendar class. It can be changed to lenient object using Calendar.setLenient() function.

Returns:
The java.util.Calendar non-lenient value.
Throws:
Asn1Exception

setDER

public void setDER(boolean bvalue)

setUTC

public void setUTC(boolean utc)
            throws Asn1Exception
This method sets the UTC flag state. If the UTC flag is true, then the time is an UTC time and symbol 'Z' is added at the end of time string. Otherwise, it is a local time.

Parameters:
utc - UTC flag state.
Throws:
Asn1Exception - Thrown, if operation is failed.

setYear

public void setYear(int year)
             throws Asn1Exception
This method sets the year component of the time value. Note that the action of this method may differentiate for different inherited Asn1Time classes.

Parameters:
year - Year component (full 4 digits).
Throws:
Asn1Exception - Thrown, if operation is failed.

setMonth

public void setMonth(int month)
              throws Asn1Exception
This method sets the month number component of the time value. The number of January is 1, February - 2, December - 12. You may use enumerating values for months encoding: Asn1Time.January, Asn1Time.February, etc. Also you can use short aliases for months: Asn1Time.Jan, Asn1Time.Feb, etc. Note that the action of this method may differentiate for different inherited Asn1Time classes.

Parameters:
month - Month component (1..12).
Throws:
Asn1Exception - Thrown, if operation is failed.

setDay

public void setDay(int day)
            throws Asn1Exception
This method sets the day of month number component of the time value. The number of the first day in month is 1, the number of the last day may be in interval from 28 to 31. Note that the action of this method may differentiate for different inherited Asn1Time classes.

Parameters:
day - Day of month component (1..31).
Throws:
Asn1Exception - Thrown, if operation is failed.

setHour

public void setHour(int hour)
             throws Asn1Exception
This method sets the hour component of the time value. As the ISO 8601 is based on the 24-hour timekeeping system, two digits represent hours from 00 to 23. Note that the action of this method may differentiate for different inherited Asn1Time classes.

Parameters:
hour - Hour component (0..23).
Throws:
Asn1Exception - Thrown, if operation is failed.

setMinute

public void setMinute(int minute)
               throws Asn1Exception
This method sets the minute component of the time value. Minutes are represented by two digits from 00 to 59. Note that the action of this method may differentiate for different inherited Asn1Time classes.

Parameters:
minute - Minute component (0..59).
Throws:
Asn1Exception - Thrown, if operation is failed.

setSecond

public void setSecond(int second)
               throws Asn1Exception
This method sets the second component of the time value. Seconds are represented by two digits from 00 to 59. Note that the action of this method may differentiate for different inherited Asn1Time classes.

Parameters:
second - Second component (0..59).
Throws:
Asn1Exception - Thrown, if operation is failed.

setFraction

public void setFraction(java.lang.String fraction)
                 throws Asn1Exception
This method sets the second's decimal fraction component of the time value. Second's decimal fraction is represented by one digit from 0 to 9. Note that the action of this method may differentiate for different inherited Asn1Time classes.

Parameters:
fraction - Second's decimal fraction component (0..9).
Throws:
Asn1Exception - Thrown, if operation is failed.

setTime

public void setTime(java.util.Calendar time)
             throws Asn1Exception
This method converts the java.util.Calendar value to time string. Note that the action of this method may differentiate for different inherited Asn1Time classes.

Parameters:
time - The calendar time value.
Throws:
Asn1Exception - Thrown, if operation is failed.

setDiffHour

public void setDiffHour(int dhour)
                 throws Asn1Exception
This method sets the hour component of the difference between the time zone of the object and Coordinated Universal Time (UTC). The UTC time is the sum of the local time and positive or negative time difference. Note that the action of this method may differentiate for different inherited Asn1Time classes.

Parameters:
dhour - The negative or positive hour component of the difference between the time zone of the object and UTC time (-12 - +12) is returned if the operation is successful.
Throws:
Asn1Exception - Thrown, if operation is failed.

setDiff

public void setDiff(int dhour,
                    int dminute)
             throws Asn1Exception
This method sets the hour and minute components of the difference between the time zone of the object and Coordinated Universal Time (UTC). The UTC time is the sum of the local time and positive or negative time difference. Note that the action of this method may differentiate for different inherited Asn1Time classes.

Parameters:
dhour - The negative or positive hour component of the difference between the time zone of the object and UTC time (-12..+12).
dminute - The negative or positive minute component of the difference between the time zone of the object and UTC time (-59..+59).
Throws:
Asn1Exception - Thrown, if operation is failed.

setDiff

public void setDiff(int inMinutes)
             throws Asn1Exception
This method sets the difference between the time zone of the object and Coordinated Universal Time (UTC), in minutes. The UTC time is the sum of the local time and positive or negative time difference. Note that the action of this method may differentiate for different inherited Asn1Time classes.

Parameters:
inMinutes - The negative or positive difference, in minutes, between the time zone of the object and UTC time (-12*60..+12*60) is returned if the operation is successful.
Throws:
Asn1Exception - Thrown, if operation is failed.

clear

public void clear()
This method clears time string. Note that the action of this method may differentiate for different inherited Asn1Time classes.


equals

public abstract boolean equals(java.lang.String s)
This method compares this object with a String value. Strictly speaking, the contract of equals stipulates identity: a.equals(b) iff b.equals(a). However, it is never the case that a String will equal an Asn1Time object. In this case, then, equals should be taken to mean that the time represented by the string passed in is the same time as the object to which it is compared. This method is implemented in all subclasses of Asn1Time.

Overrides:
equals in class Asn1CharString
Parameters:
s -

equals

public boolean equals(java.lang.Object other)
This method compares this object with Asn1Time class instance or with Calendar instance. The behavior of this method may be different for different inherited Asn1Time classes. It will return false for all uninitialized time types: so new Asn1UTCTime().equals(new Asn1UTCTime()) will return false.

Overrides:
equals in class Asn1CharString
Parameters:
other - Object (instance of Asn1Time or Calendar) to be compared.
Returns:
true, if objects are equal. Uninitialized times are not equal.

compareTo

public int compareTo(java.lang.Object other)
This method compares this object with Asn1Time class instance or with Calendar instance. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object. Note that the action of this method may differentiate for different inherited Asn1Time classes.

Specified by:
compareTo in interface java.lang.Comparable
Parameters:
other - the Object to be compared.
Returns:
a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

parseString

public abstract void parseString(java.lang.String string)
                          throws Asn1Exception
This method parses passed time string. Note that the action of this method may differentiate for different inherited Asn1Time classes.

Parameters:
string - The time string value to be parsed.
Throws:
Asn1Exception - Thrown, if operation is failed.

compileString

protected abstract boolean compileString()
                                  throws Asn1Exception
Compiles new time string accoring X.680 (clauses 41, 42) and ISO 8601.

Returns:
true, if succeed, or false code, if error.
Throws:
Asn1Exception - Thrown, if operation is failed.

parseInt

protected static int parseInt(java.lang.String str,
                              IntHolder off,
                              int len)
Parses integer value using String.

Parameters:
str - string is containing integer to be parsed.
off - start offset int the String.
len - number of digits to be parsed.
Returns:
Parsed integer value.

putInteger

public static void putInteger(java.lang.StringBuffer data,
                              int width,
                              int value)
Puts integer in string buffer

Parameters:
data - destination buffer
width - number of digits
value - value to be put

putInteger

protected void putInteger(int width,
                          int value)
Puts integer in string buffer

Parameters:
width - number of digits
value - value to be put

charAt

protected static char charAt(java.lang.String s,
                             int index)
Returns the character at the specified index in the specified string. If index is out of bounds, then '' character will be returned.

Returns:
Character at the specified index. or ''.

safeParseString

protected void safeParseString()

decode

protected void decode(Asn1BerDecodeBuffer buffer,
                      boolean explicit,
                      int implicitLength,
                      Asn1Tag tag)
               throws Asn1Exception,
                      java.io.IOException
This method decodes an ASN.1 character string value including the UNIVERSAL tag value and length if explicit tagging is specified. It is a protected method that can only be accessed by objects subclassed from this type.

Overrides:
decode in class Asn1CharString
Parameters:
buffer - Decode message buffer object
explicit - Flag indicating element is explicitly tagged
implicitLength - Length of contents if implicit
Throws:
Asn1Exception
java.io.IOException

encode

protected int encode(Asn1BerEncodeBuffer buffer,
                     boolean explicit,
                     Asn1Tag tag)
              throws Asn1Exception
This method encodes ASN.1 time string type. The UNIVERSAL tag value and length is also encoded if explicit tagging is specified (the universal identifier must be provided by the caller).

Overrides:
encode in class Asn1CharString
Parameters:
buffer - Encode message buffer object
explicit - Flag indicating explicit tagging should be done
tag - Universal tag to apply
Returns:
Length in octets of encoded component
Throws:
Asn1Exception

decode

public void decode(Asn1PerDecodeBuffer buffer)
            throws Asn1Exception,
                   java.io.IOException
This method is the base implementation of the standard Packed Encoding Rules (PER) decode method. It throws an exception because it should never be invoked by compiler generated code.

Specified by:
decode in interface Asn1TypeIF
Overrides:
decode in class Asn18BitCharString
Parameters:
buffer - PER Encode message buffer object
Throws:
Asn1Exception
java.io.IOException

encode

public void encode(Asn1PerEncodeBuffer buffer)
            throws Asn1Exception,
                   java.io.IOException
This method is the base implementation of the standard Packed Encoding Rules (PER) encode method. It throws an exception because it should never be invoked by compiler generated code.

Specified by:
encode in interface Asn1TypeIF
Overrides:
encode in class Asn18BitCharString
Parameters:
buffer - PER Encode message buffer object
Throws:
Asn1Exception
java.io.IOException

encode

public void encode(Asn1BerOutputStream out,
                   boolean explicit,
                   Asn1Tag tag)
            throws Asn1Exception,
                   java.io.IOException
This method encodes and writes to the stream an ASN.1 time string value including the UNIVERSAL tag value and length if explicit tagging is specified. This overloaded version uses the Basic Encoding Rules (BER).

Parameters:
out - BER Output Stream object
explicit - Flag indicating explicit tagging should be done
tag - Universal tag to apply
Throws:
java.io.IOException - Any exception thrown by the underlying OutputStream.
Asn1Exception - Thrown, if operation is failed.

encode

public void encode(Asn1PerOutputStream out)
            throws Asn1Exception,
                   java.io.IOException
This method encodes and writes to stream an ASN.1 time string value using the standard Packed Encoding Rules (PER) encode method.

Specified by:
encode in interface Asn1TypeIF
Overrides:
encode in class Asn18BitCharString
Parameters:
out - PER Output Stream object
Throws:
java.io.IOException - Any exception thrown by the Asn1PerOutputStream.
Asn1Exception - Thrown, if operation is failed.

decodeXML

public void decodeXML(java.lang.String buffer,
                      java.lang.String attrs)
               throws Asn1Exception
This method decodes ASN.1 GeneralizedTime type, using the XML schema encoding rules.

Specified by:
decodeXML in interface Asn1TypeIF
Overrides:
decodeXML in class Asn1CharString
Parameters:
buffer - String containing data to be decoded
attrs - Attributes string from element tag
Throws:
Asn1Exception

parseXmlString

public void parseXmlString(java.lang.String string)
                    throws Asn1Exception
This method parses the given time string value. String must be in XML schema dateTime format. It will throw and exception if the string is not in the valid time format.

Parameters:
string - The time string value to be parsed.
Throws:
Asn1Exception - Thrown, if operation is failed.

encode

public void encode(Asn1XmlEncoder buffer,
                   java.lang.String elemName,
                   java.lang.String nsPrefix)
            throws java.io.IOException,
                   Asn1Exception
This method encodes this ASN.1 time into xsd:dateTime format with element and attribute name tag according to the XML Encoding as specified in the XML schema standard(asn2xsd). This is for use with Obj-Sys XML encoding rules.

Overrides:
encode in class Asn1CharString
Parameters:
buffer - Encode message buffer object
elemName - XML element name used to wrap string
nsPrefix - Element namespace prefix value
Throws:
java.io.IOException
Asn1Exception

encodeXER

public void encodeXER(Asn1XmlEncoder buffer,
                      java.lang.String elemName,
                      java.lang.String nsPrefix)
               throws java.io.IOException,
                      Asn1Exception
This method encodes this ASN.1 time according to XER encoding rules. It is used by generated code when compiling for extended-XER.

Parameters:
buffer - Encode message buffer object
elemName - XML element name used to wrap string
nsPrefix - Element namespace prefix value
Throws:
java.io.IOException
Asn1Exception

encodeXMLData

public void encodeXMLData(Asn1XmlXerEncoder buffer)
                   throws java.io.IOException,
                          Asn1Exception
This method encodes this ASN.1 time string into xsd:dateTime format. XML dateTime format is YYYY-MM-DDTHH:MM:SS[.SSSS][(Z|(+|-) HH:MM)]

Parameters:
buffer - String buffer to hold the converted xml time string
Throws:
java.io.IOException
Asn1Exception