com.objsys.asn1j.runtime
Class Asn1PerTime

java.lang.Object
  extended by com.objsys.asn1j.runtime.Asn1PerTime

public class Asn1PerTime
extends java.lang.Object

Provides methods to encode and decode TIME values in PER. The application representation of the TIME value is a TimeValue, as defined in X.680. Some notes on formatting: + A year/century should have a leading plus sign if and only if the year/century > 9999/99. + A year/century having 5/3 or more digits should never include leading zeros. A value with a year of 1985 has the property Year="Basic" and is formatted with only 4 digits, never more. + A year/century should never have fewer than four/two digits. This is the only case where leading zeros may be used. + When FRACTION is used to specify a number of fraction digits, the string representation must have precisely that many digits for the fraction. Note that FRACTION is not to be used with DURATION.


Field Summary
static int ANY
          With CENTURY/YEAR, ANY indicates that century/year is unconstrained.
static int CENTURY
           
static int DATE
           
static int DATE_TIME
           
static int DAY
           
static int DIFF
          Indicates a time includes a timezone difference from UTC.
static int DT_ANY_CENTURY
           
static int DT_ANY_YEAR
           
static int DT_ANY_YEAR_DAY
           
static int DT_ANY_YEAR_MONTH
           
static int DT_ANY_YEAR_MONTH_DAY
           
static int DT_ANY_YEAR_WEEK
           
static int DT_ANY_YEAR_WEEK_DAY
           
static int DT_CENTURY
           
static int DT_HOURS
           
static int DT_HOURS_AND_DIFF
           
static int DT_HOURS_AND_DIFF_AND_FRACTION
           
static int DT_HOURS_AND_FRACTION
           
static int DT_HOURS_UTC
           
static int DT_HOURS_UTC_AND_FRACTION
           
static int DT_MINUTES
           
static int DT_MINUTES_AND_DIFF
           
static int DT_MINUTES_AND_DIFF_AND_FRACTION
           
static int DT_MINUTES_AND_FRACTION
           
static int DT_MINUTES_UTC
           
static int DT_MINUTES_UTC_AND_FRACTION
           
static int DT_SECONDS
           
static int DT_SECONDS_AND_DIFF
           
static int DT_SECONDS_AND_DIFF_AND_FRACTION
           
static int DT_SECONDS_AND_FRACTION
           
static int DT_SECONDS_UTC
           
static int DT_SECONDS_UTC_AND_FRACTION
           
static int DT_YEAR
           
static int DT_YEAR_DAY
           
static int DT_YEAR_MONTH
           
static int DT_YEAR_MONTH_DAY
           
static int DT_YEAR_WEEK
           
static int DT_YEAR_WEEK_DAY
           
static int DURATION
          Indicates a duration.
static int FRACTION
          This is a mask that is used to mark off the bits used for the number of decimal places for a fraction.
static int HOURS
           
static int MINUTES
           
static int MONTH
           
static int SECONDS
           
static int TIME_OF_DAY
           
static int UTC
          Indicates a time is UTC.
static int WEEK
          Week is present.
static int YEAR
           
 
Constructor Summary
Asn1PerTime()
           
 
Method Summary
static java.lang.String decodeDate(Asn1PerDecodeBuffer source, int flags)
          Decode a date value from the given source.
static java.lang.String decodeDateTime(Asn1PerDecodeBuffer source, int flags)
          Decode a date-time value from the given source.
static java.lang.String decodeDuration(Asn1PerDecodeBuffer source, boolean recurring)
          Decode a (possibly recurring) duration from the given source.
static java.lang.String decodeIntervalDE(Asn1PerDecodeBuffer source, boolean recurring, int flags)
           
static java.lang.String decodeIntervalSD(Asn1PerDecodeBuffer source, boolean recurring, int flags)
           
static java.lang.String decodeIntervalSE(Asn1PerDecodeBuffer source, boolean recurring, int flags)
           
static java.lang.String decodeTime(Asn1PerDecodeBuffer source, int flags)
          Decode a time value from the given source.
static void encodeDate(Asn1PerEncoder encoder, java.lang.String value, int flags)
          Encode a date value using the given encoder.
static void encodeDateTime(Asn1PerEncoder encoder, java.lang.String value, int flags)
          Encode a datetime value.
static void encodeDuration(Asn1PerEncoder encoder, java.lang.String value, boolean recurring)
          Encode a duration.
static void encodeIntervalDE(Asn1PerEncoder encoder, java.lang.String value, boolean recurring, int flags)
           
static void encodeIntervalSD(Asn1PerEncoder encoder, java.lang.String value, boolean recurring, int flags)
           
static void encodeIntervalSE(Asn1PerEncoder encoder, java.lang.String value, boolean recurring, int flags)
           
static void encodeTime(Asn1PerEncoder encoder, java.lang.String value, int flags)
          Encode a time value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ANY

public static final int ANY
With CENTURY/YEAR, ANY indicates that century/year is unconstrained.

See Also:
Constant Field Values

CENTURY

public static final int CENTURY
See Also:
Constant Field Values

YEAR

public static final int YEAR
See Also:
Constant Field Values

MONTH

public static final int MONTH
See Also:
Constant Field Values

WEEK

public static final int WEEK
Week is present. When used for a duration (with DURATION), the following are excluded: CENTURY, YEAR, MONTH, DAY, HOURS, MINUTES, SECONDS

When used for a date/datetime (without DURATION), MONTH is excluded.

See Also:
Constant Field Values

DAY

public static final int DAY
See Also:
Constant Field Values

HOURS

public static final int HOURS
See Also:
Constant Field Values

MINUTES

public static final int MINUTES
See Also:
Constant Field Values

SECONDS

public static final int SECONDS
See Also:
Constant Field Values

UTC

public static final int UTC
Indicates a time is UTC. Its string format includes the 'Z' timezone designator.

See Also:
Constant Field Values

DIFF

public static final int DIFF
Indicates a time includes a timezone difference from UTC.

See Also:
Constant Field Values

FRACTION

public static final int FRACTION
This is a mask that is used to mark off the bits used for the number of decimal places for a fraction.

value & FRACTION = # of decimal places

See Also:
Constant Field Values

DURATION

public static final int DURATION
Indicates a duration. No other flags should be used with DURATION.

See Also:
Constant Field Values

DT_ANY_CENTURY

public static final int DT_ANY_CENTURY
See Also:
Constant Field Values

DT_ANY_YEAR

public static final int DT_ANY_YEAR
See Also:
Constant Field Values

DT_ANY_YEAR_MONTH

public static final int DT_ANY_YEAR_MONTH
See Also:
Constant Field Values

DT_ANY_YEAR_MONTH_DAY

public static final int DT_ANY_YEAR_MONTH_DAY
See Also:
Constant Field Values

DT_ANY_YEAR_DAY

public static final int DT_ANY_YEAR_DAY
See Also:
Constant Field Values

DT_ANY_YEAR_WEEK

public static final int DT_ANY_YEAR_WEEK
See Also:
Constant Field Values

DT_ANY_YEAR_WEEK_DAY

public static final int DT_ANY_YEAR_WEEK_DAY
See Also:
Constant Field Values

DT_CENTURY

public static final int DT_CENTURY
See Also:
Constant Field Values

DT_YEAR

public static final int DT_YEAR
See Also:
Constant Field Values

DT_YEAR_MONTH

public static final int DT_YEAR_MONTH
See Also:
Constant Field Values

DT_YEAR_MONTH_DAY

public static final int DT_YEAR_MONTH_DAY
See Also:
Constant Field Values

DT_YEAR_DAY

public static final int DT_YEAR_DAY
See Also:
Constant Field Values

DT_YEAR_WEEK

public static final int DT_YEAR_WEEK
See Also:
Constant Field Values

DT_YEAR_WEEK_DAY

public static final int DT_YEAR_WEEK_DAY
See Also:
Constant Field Values

DT_HOURS

public static final int DT_HOURS
See Also:
Constant Field Values

DT_HOURS_UTC

public static final int DT_HOURS_UTC
See Also:
Constant Field Values

DT_HOURS_AND_DIFF

public static final int DT_HOURS_AND_DIFF
See Also:
Constant Field Values

DT_MINUTES

public static final int DT_MINUTES
See Also:
Constant Field Values

DT_MINUTES_UTC

public static final int DT_MINUTES_UTC
See Also:
Constant Field Values

DT_MINUTES_AND_DIFF

public static final int DT_MINUTES_AND_DIFF
See Also:
Constant Field Values

DT_SECONDS

public static final int DT_SECONDS
See Also:
Constant Field Values

DT_SECONDS_UTC

public static final int DT_SECONDS_UTC
See Also:
Constant Field Values

DT_SECONDS_AND_DIFF

public static final int DT_SECONDS_AND_DIFF
See Also:
Constant Field Values

DT_HOURS_AND_FRACTION

public static final int DT_HOURS_AND_FRACTION
See Also:
Constant Field Values

DT_HOURS_UTC_AND_FRACTION

public static final int DT_HOURS_UTC_AND_FRACTION
See Also:
Constant Field Values

DT_HOURS_AND_DIFF_AND_FRACTION

public static final int DT_HOURS_AND_DIFF_AND_FRACTION
See Also:
Constant Field Values

DT_MINUTES_AND_FRACTION

public static final int DT_MINUTES_AND_FRACTION
See Also:
Constant Field Values

DT_MINUTES_UTC_AND_FRACTION

public static final int DT_MINUTES_UTC_AND_FRACTION
See Also:
Constant Field Values

DT_MINUTES_AND_DIFF_AND_FRACTION

public static final int DT_MINUTES_AND_DIFF_AND_FRACTION
See Also:
Constant Field Values

DT_SECONDS_AND_FRACTION

public static final int DT_SECONDS_AND_FRACTION
See Also:
Constant Field Values

DT_SECONDS_UTC_AND_FRACTION

public static final int DT_SECONDS_UTC_AND_FRACTION
See Also:
Constant Field Values

DT_SECONDS_AND_DIFF_AND_FRACTION

public static final int DT_SECONDS_AND_DIFF_AND_FRACTION
See Also:
Constant Field Values

DATE

public static final int DATE
See Also:
Constant Field Values

TIME_OF_DAY

public static final int TIME_OF_DAY
See Also:
Constant Field Values

DATE_TIME

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

Asn1PerTime

public Asn1PerTime()
Method Detail

decodeDate

public static java.lang.String decodeDate(Asn1PerDecodeBuffer source,
                                          int flags)
                                   throws Asn1Exception
Decode a date value from the given source. This should be used for types having Basic="Date".

Parameters:
source -
flags -
Returns:
ASN.1 TimeValue representation of decoded value
Throws:
Asn1Exception

decodeDateTime

public static java.lang.String decodeDateTime(Asn1PerDecodeBuffer source,
                                              int flags)
                                       throws Asn1Exception
Decode a date-time value from the given source. This should be used for types having Basic="Date-Time".

Parameters:
source -
flags - Indicates what fields are expected. The flags should indicate a complete date (YMD, YWD, or YD) and at least an hour component.
Returns:
The value represented as an ASN.1 TimeValue
Throws:
Asn1Exception

decodeDuration

public static java.lang.String decodeDuration(Asn1PerDecodeBuffer source,
                                              boolean recurring)
                                       throws Asn1Exception
Decode a (possibly recurring) duration from the given source. This should be used for types having Basic="Interval" or "Rec-Interval" and Interval-type="D"

Parameters:
source -
recurring - true if the duration is a recurring duration
Returns:
Throws:
Asn1Exception

decodeIntervalSE

public static java.lang.String decodeIntervalSE(Asn1PerDecodeBuffer source,
                                                boolean recurring,
                                                int flags)
                                         throws Asn1Exception
Throws:
Asn1Exception

decodeIntervalSD

public static java.lang.String decodeIntervalSD(Asn1PerDecodeBuffer source,
                                                boolean recurring,
                                                int flags)
                                         throws Asn1Exception
Throws:
Asn1Exception

decodeIntervalDE

public static java.lang.String decodeIntervalDE(Asn1PerDecodeBuffer source,
                                                boolean recurring,
                                                int flags)
                                         throws Asn1Exception
Throws:
Asn1Exception

decodeTime

public static java.lang.String decodeTime(Asn1PerDecodeBuffer source,
                                          int flags)
                                   throws Asn1Exception
Decode a time value from the given source. This should be used for types having Basic="Time".

Parameters:
source -
flags - Indicates the expected fields.
Returns:
Throws:
Asn1Exception

encodeDate

public static void encodeDate(Asn1PerEncoder encoder,
                              java.lang.String value,
                              int flags)
                       throws Asn1Exception
Encode a date value using the given encoder. This should be used for types having Basic="Date".

Parameters:
encoder -
value -
flags -
Throws:
Asn1Exception

encodeDateTime

public static void encodeDateTime(Asn1PerEncoder encoder,
                                  java.lang.String value,
                                  int flags)
                           throws Asn1Exception
Encode a datetime value. This should be used for types having Basic="Date-Time".

Parameters:
encoder -
value -
flags -
Throws:
Asn1Exception

encodeDuration

public static void encodeDuration(Asn1PerEncoder encoder,
                                  java.lang.String value,
                                  boolean recurring)
                           throws Asn1Exception
Encode a duration. This should be used for types having Basic="Interval" or "Rec-Interval", and Interval-type="D".

Parameters:
encoder -
value - The duration
recurring - true if value represents a recurring duration.
Throws:
Asn1Exception

encodeIntervalSE

public static void encodeIntervalSE(Asn1PerEncoder encoder,
                                    java.lang.String value,
                                    boolean recurring,
                                    int flags)
                             throws Asn1Exception
Throws:
Asn1Exception

encodeIntervalSD

public static void encodeIntervalSD(Asn1PerEncoder encoder,
                                    java.lang.String value,
                                    boolean recurring,
                                    int flags)
                             throws Asn1Exception
Throws:
Asn1Exception

encodeIntervalDE

public static void encodeIntervalDE(Asn1PerEncoder encoder,
                                    java.lang.String value,
                                    boolean recurring,
                                    int flags)
                             throws Asn1Exception
Throws:
Asn1Exception

encodeTime

public static void encodeTime(Asn1PerEncoder encoder,
                              java.lang.String value,
                              int flags)
                       throws Asn1Exception
Encode a time value. This should be used for types having Basic="Time".

Parameters:
encoder -
value -
flags -
Throws:
Asn1Exception