|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.objsys.asn1j.runtime.Asn1Type com.objsys.asn1j.runtime.Asn1CharString com.objsys.asn1j.runtime.Asn18BitCharString com.objsys.asn1j.runtime.Asn1Time
public abstract class Asn1Time
This is a base class for holding the components of an ASN.1 generalized and universal times string value.
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, mAsn1TypeName, 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, getAsn1TypeName, 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 |
---|
protected transient int year
protected transient int month
protected transient int day
protected transient int hour
protected transient int minute
protected transient int second
protected transient java.lang.String secFraction
protected transient int diffHour
protected transient int diffMin
protected transient boolean utcFlag
protected transient boolean parsed
protected transient boolean derRules
public static final int January
public static final int Jan
public static final int February
public static final int Feb
public static final int March
public static final int Mar
public static final int April
public static final int Apr
public static final int May
public static final int June
public static final int Jun
public static final int July
public static final int Jul
public static final int August
public static final int Aug
public static final int September
public static final int Sep
public static final int October
public static final int Oct
public static final int November
public static final int Nov
public static final int December
public static final int Dec
Constructor Detail |
---|
public Asn1Time(short typeCode, boolean useDerRules)
typeCode
- Integer constant from Asn1Type class
(Asn1Type.GeneralTime
or Asn1Type.UTCTime
).useDerRules
- 'true' if time string should be encoded with DER/PER.public Asn1Time(java.lang.String data, short typeCode, boolean useDerRules)
data
String.
typeCode
- Integer constant from Asn1Type class
(Asn1Type.GeneralTime
or Asn1Type.UTCTime
).useDerRules
- 'true' if time string should be encoded with DER/PER.Method Detail |
---|
protected void init()
public int getYear() throws Asn1Exception
Asn1Exception
- Thrown, if operation is failed.public int getMonth() throws Asn1Exception
Asn1Exception
- Thrown, if operation is failed.public int getDay() throws Asn1Exception
Asn1Exception
- Thrown, if operation is failed.public int getHour() throws Asn1Exception
Asn1Exception
- Thrown, if operation is failed.public int getMinute() throws Asn1Exception
Asn1Exception
- Thrown, if operation is failed.public int getSecond() throws Asn1Exception
Asn1Exception
- Thrown, if operation is failed.public java.lang.String getFraction() throws Asn1Exception
Asn1Exception
- Thrown, if operation is failed.public int getDiffHour() throws Asn1Exception
Asn1Exception
- Thrown, if operation is failed.public int getDiffMinute() throws Asn1Exception
Asn1Exception
- Thrown, if operation is failed.public int getDiff() throws Asn1Exception
Asn1Exception
- Thrown, if operation is failed.public boolean getUTC() throws Asn1Exception
Asn1Exception
- Thrown, if operation is failed.public java.util.Calendar getTime() throws Asn1Exception
Asn1Exception
public void setDER(boolean bvalue)
public void setUTC(boolean utc) throws Asn1Exception
utc
- UTC flag state.
Asn1Exception
- Thrown, if operation is failed.public void setYear(int year) throws Asn1Exception
year
- Year component (full 4 digits).
Asn1Exception
- Thrown, if operation is failed.public void setMonth(int month) throws Asn1Exception
month
- Month component (1..12).
Asn1Exception
- Thrown, if operation is failed.public void setDay(int day) throws Asn1Exception
day
- Day of month component (1..31).
Asn1Exception
- Thrown, if operation is failed.public void setHour(int hour) throws Asn1Exception
hour
- Hour component (0..23).
Asn1Exception
- Thrown, if operation is failed.public void setMinute(int minute) throws Asn1Exception
minute
- Minute component (0..59).
Asn1Exception
- Thrown, if operation is failed.public void setSecond(int second) throws Asn1Exception
second
- Second component (0..59).
Asn1Exception
- Thrown, if operation is failed.public void setFraction(java.lang.String fraction) throws Asn1Exception
fraction
- Second's decimal fraction component (0..9).
Asn1Exception
- Thrown, if operation is failed.public void setTime(java.util.Calendar time) throws Asn1Exception
time
- The calendar time value.
Asn1Exception
- Thrown, if operation is failed.public void setDiffHour(int dhour) throws Asn1Exception
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.
Asn1Exception
- Thrown, if operation is failed.public void setDiff(int dhour, int dminute) throws Asn1Exception
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).
Asn1Exception
- Thrown, if operation is failed.public void setDiff(int inMinutes) throws Asn1Exception
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.
Asn1Exception
- Thrown, if operation is failed.public void clear()
public abstract boolean equals(java.lang.String s)
equals
in class Asn1CharString
s
- public boolean equals(java.lang.Object other)
equals
in class Asn1CharString
other
- Object (instance of Asn1Time or Calendar) to be compared.
public int compareTo(java.lang.Object other)
compareTo
in interface java.lang.Comparable
other
- the Object to be compared.
public abstract void parseString(java.lang.String string) throws Asn1Exception
string
- The time string value to be parsed.
Asn1Exception
- Thrown, if operation is failed.protected abstract boolean compileString() throws Asn1Exception
Asn1Exception
- Thrown, if operation is failed.protected static int parseInt(java.lang.String str, IntHolder off, int len)
str
- string is containing integer to be parsed.off
- start offset int the String.len
- number of digits to be parsed.
public static void putInteger(java.lang.StringBuffer data, int width, int value)
data
- destination bufferwidth
- number of digitsvalue
- value to be putprotected void putInteger(int width, int value)
width
- number of digitsvalue
- value to be putprotected static char charAt(java.lang.String s, int index)
protected void safeParseString()
protected void decode(Asn1BerDecodeBuffer buffer, boolean explicit, int implicitLength, Asn1Tag tag) throws Asn1Exception, java.io.IOException
decode
in class Asn1CharString
buffer
- Decode message buffer objectexplicit
- Flag indicating element is explicitly taggedimplicitLength
- Length of contents if implicit
Asn1Exception
java.io.IOException
protected int encode(Asn1BerEncodeBuffer buffer, boolean explicit, Asn1Tag tag) throws Asn1Exception
encode
in class Asn1CharString
buffer
- Encode message buffer objectexplicit
- Flag indicating explicit tagging should be donetag
- Universal tag to apply
Asn1Exception
public void decode(Asn1PerDecodeBuffer buffer) throws Asn1Exception, java.io.IOException
decode
in interface Asn1TypeIF
decode
in class Asn18BitCharString
buffer
- PER Encode message buffer object
Asn1Exception
java.io.IOException
public void encode(Asn1PerEncodeBuffer buffer) throws Asn1Exception, java.io.IOException
encode
in interface Asn1TypeIF
encode
in class Asn18BitCharString
buffer
- PER Encode message buffer object
Asn1Exception
java.io.IOException
public void encode(Asn1BerOutputStream out, boolean explicit, Asn1Tag tag) throws Asn1Exception, java.io.IOException
out
- BER Output Stream objectexplicit
- Flag indicating explicit tagging should be donetag
- Universal tag to apply
java.io.IOException
- Any exception thrown by the underlying OutputStream.
Asn1Exception
- Thrown, if operation is failed.public void encode(Asn1PerOutputStream out) throws Asn1Exception, java.io.IOException
encode
in interface Asn1TypeIF
encode
in class Asn18BitCharString
out
- PER Output Stream object
java.io.IOException
- Any exception thrown by the Asn1PerOutputStream.
Asn1Exception
- Thrown, if operation is failed.public void decodeXML(java.lang.String buffer, java.lang.String attrs) throws Asn1Exception
decodeXML
in interface Asn1TypeIF
decodeXML
in class Asn1CharString
buffer
- String containing data to be decodedattrs
- Attributes string from element tag
Asn1Exception
public void parseXmlString(java.lang.String string) throws Asn1Exception
string
- The time string value to be parsed.
Asn1Exception
- Thrown, if operation is failed.public void encode(Asn1XmlEncoder buffer, java.lang.String elemName, java.lang.String nsPrefix) throws java.io.IOException, Asn1Exception
encode
in class Asn1CharString
buffer
- Encode message buffer objectelemName
- XML element name used to wrap stringnsPrefix
- Element namespace prefix value
java.io.IOException
Asn1Exception
public void encodeXER(Asn1XmlEncoder buffer, java.lang.String elemName, java.lang.String nsPrefix) throws java.io.IOException, Asn1Exception
buffer
- Encode message buffer objectelemName
- XML element name used to wrap stringnsPrefix
- Element namespace prefix value
java.io.IOException
Asn1Exception
public void encodeXMLData(Asn1XmlXerEncoder buffer) throws java.io.IOException, Asn1Exception
buffer
- String buffer to hold the converted xml time string
java.io.IOException
Asn1Exception
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |