|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectpasn.misc.ASN1TimeValue
public final class ASN1TimeValue
Simplifies time assignment to ASN.1 time objects.
Please refer to ASN1UTCTime
or ASN1GeneralizedTime
for time formats signfication
Field Summary | |
---|---|
static int |
DAY
|
static java.lang.String |
DEFAULT_TIMEZONE
Default timezone value, set to GMT+0000 |
static int |
HOUR
|
static int |
MILLISECOND
|
static int |
MINUTE
|
static int |
MONTH
|
static int |
SECOND
|
static int |
YEAR
|
Constructor Summary | |
---|---|
ASN1TimeValue(boolean shortYear)
Creates a non-initialized time value. |
Method Summary | |
---|---|
ASN1TimeValue |
duplicate()
Creates a copy of this time value |
boolean |
equals(java.lang.Object obj)
|
int |
getDay()
|
int |
getField(int timeField)
Retrieves a particular time field. |
int |
getHour()
|
int |
getMillisecond()
|
int |
getMinute()
|
int |
getMonth()
|
int |
getSecond()
|
ASN1TimeFormat |
getTimeFormat()
Returns the printing (or encoding) format of this TIME object |
java.lang.String |
getTimeZone()
Returns the current time zone identifier |
java.util.Calendar |
getValue()
Returns the date value enclosed within this time object |
int |
getYear()
|
boolean |
isInitialized()
Indicates whether this time object is initialized with a time value or not |
boolean |
isShortYear()
|
boolean |
isValid()
|
static boolean |
isValid(int year,
int month,
int day,
int hour,
int minute,
int second,
int milli,
java.util.TimeZone tz)
|
void |
reset()
Disables time fields values so that isInitialized() returns
false. |
void |
setMillisecond(int milli)
Initializes the millisecond field. |
void |
setTimeFormat(ASN1TimeFormat tf)
Sets the format for printing or encoding among the proposed formats of this TIME object |
void |
setTimeZone()
Sets the current timezone to DEFAULT_TIMEZONE |
void |
setTimeZone(java.lang.String zone)
Sets the time deviation around GMT to create accurate times by differencing time zones |
void |
setValue()
Sets this time with the current date and time values |
void |
setValue(java.util.Calendar value)
Sets the internal time with the given calendar |
void |
setValue(java.util.Date value)
Sets this time with the given date and time values |
void |
setValues(int year,
int month,
int day,
int hour,
int minute,
int second)
Initializes all the internal time fields but milliseconds. |
java.lang.String |
toString()
|
java.lang.String |
toString(ASN1TimeFormat format,
boolean shortYear)
|
Methods inherited from class java.lang.Object |
---|
getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int YEAR
public static final int MONTH
public static final int DAY
public static final int HOUR
public static final int MINUTE
public static final int SECOND
public static final int MILLISECOND
public static final java.lang.String DEFAULT_TIMEZONE
GMT+0000
Constructor Detail |
---|
public ASN1TimeValue(boolean shortYear)
Creates a non-initialized time value.
Timezone is set to DEFAULT_TIMEZONE
shortYear
- True means 2-digits year and false
4-digits yearsetValue()
Method Detail |
---|
public boolean isValid()
public static boolean isValid(int year, int month, int day, int hour, int minute, int second, int milli, java.util.TimeZone tz)
public boolean isShortYear()
public void setValue()
public void setValue(java.util.Date value)
value
- The date to initialize this time object with. A
null date value represents the current time value and is
strictly equivalent to setValue()
public void setValue(java.util.Calendar value)
value
- The date to initialize this time object with. A
null value represents the current time value and is strictly
equivalent to setValue()
public void setTimeZone()
DEFAULT_TIMEZONE
setTimeZone(String)
public void setTimeZone(java.lang.String zone)
zone
- A stringified time zone, such as "GMT+01:00". The general
syntax is GMT[+|-]hh[[:]mm]. DEFAULT_TIMEZONE
is
used in case the given timezone ID is not valid according to the general
syntax and accepted hh and mm valuespublic void setValues(int year, int month, int day, int hour, int minute, int second)
year
- Year value (such as 2005)month
- Month index, given by any value of MONTH
day
- Day index, which corresponds to DAY
hour
- Hour of the day, which corresponds to HOUR
minute
- Minutes within the current hour, which corresponds to
MINUTE
second
- Seconds within the current minute, which corresponds to
SECOND
setMillisecond(int)
public void setMillisecond(int milli)
milli
- A positive number of milliseconds, which corresponds to
MILLISECOND
public boolean isInitialized()
reset()
for examplepublic int getField(int timeField)
timeField
- The field identifier to retrieve from, among:
Calendar.YEAR
Calendar.MONTH
Calendar.DAY_OF_MONTH
Calendar.HOUR_OF_DAY
Calendar.MINUTE
Calendar.SECOND
Calendar.MILLISECOND
public int getYear()
public int getMonth()
public int getDay()
public int getHour()
public int getMinute()
public int getSecond()
public int getMillisecond()
public java.lang.String getTimeZone()
public java.util.Calendar getValue()
public void reset()
Disables time fields values so that isInitialized()
returns
false.
Note that this operation does not initialize the current time zone to its default value
public void setTimeFormat(ASN1TimeFormat tf)
tf
- An encoding format provided by this TIME object. An
out-of-range format is equivalent to set to default format (FORMAT_0)public ASN1TimeFormat getTimeFormat()
public ASN1TimeValue duplicate()
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toString(ASN1TimeFormat format, boolean shortYear)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |