| 
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sourceforge.jsdp.Time
public class Time
A Time represents a t=<field value> field contained in a SDP message. A time field specifies the start and stop times for a SDP announce.
| Field Summary | |
|---|---|
static long | 
NTP_CONSTANT
Constant used to translate between NTP time used in SDP and "native" Java time.  | 
protected  long | 
start
The session start time  | 
protected  long | 
stop
The session stop time  | 
| Fields inherited from interface net.sourceforge.jsdp.Field | 
|---|
ATTRIBUTE_FIELD, BANDWITH_FIELD, CONNECTION_FIELD, EMAIL_FIELD, END_OF_FIELD, INFORMATION_FIELD, KEY_FIELD, MEDIA_FIELD, ORIGIN_FIELD, PHONE_FIELD, REPEAT_TIME_FIELD, SESSION_NAME_FIELD, TIME_FIELD, TIMEZONE_FIELD, URI_FIELD, VERSION_FIELD | 
| Constructor Summary | |
|---|---|
Time()
Creates a new Time.  | 
|
Time(Date start,
     Date stop)
Creates a new Time.  | 
|
Time(long start,
     long stop)
Creates a new Time.  | 
|
| Method Summary | |
|---|---|
 Object | 
clone()
Returns a clone of this field.  | 
static Date | 
getDateFromNtp(long ntpTime)
Returns a Date object for a given NTP date value.  | 
static long | 
getNTP(Date date)
Transform a Date in a long containing the corresponding NTP value.  | 
 Date | 
getStartTime()
Returns the start time of the session.  | 
 Date | 
getStopTime()
Returns the stop time of the session.  | 
 char | 
getType()
Returns the type character for the field.  | 
static boolean | 
isValidNTP(String input)
Indicates if a string represents a valid NTP value.  | 
 boolean | 
isZero()
Returns whether the start and stop times were set to zero (in NTP).  | 
static Time | 
parse(String field)
Parse an input string and constructs the equivalent time field.  | 
 void | 
setStartTime(Date start)
Sets the start time of the session.  | 
 void | 
setStartTime(long start)
Sets the start time of the session.  | 
 void | 
setStopTime(Date stop)
Sets the stop time of the session.  | 
 void | 
setStopTime(long stop)
Sets the stop time of the session.  | 
 void | 
setZero()
Sets the start and stop times to zero (in NTP).  | 
 String | 
toString()
Returns a string representation of the field.  | 
| Methods inherited from class java.lang.Object | 
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait | 
| Field Detail | 
|---|
public static final long NTP_CONSTANT
System.currentTimeMillis()).
 
 The value of this constant is 2208988800L. It can be used to convert between NTP and Java time using the following formulas:
ntpTime = (javaTime/1000) + Time.NTP_CONST;javaTime = (ntpTime - Time.NTP_CONST) * 1000;The Network Time Protocol (NTP) is defined in RFC 1305.
protected long start
protected long stop
| Constructor Detail | 
|---|
public Time()
public Time(Date start,
            Date stop)
     throws SDPException
start - the session start timestop - the session stop time
SDPException - if the NTP representation of the session start
         and/or stop time are negative
public Time(long start,
            long stop)
     throws SDPException
start - the session start timestop - the session stop time
SDPException - if the session start or stop time are negative| Method Detail | 
|---|
public static Date getDateFromNtp(long ntpTime)
ntpTime - the NTP date value
public static long getNTP(Date date)
date - the Date to transform
public static boolean isValidNTP(String input)
input - the string to test
public static Time parse(String field)
                  throws SDPParseException
field - the string to parse
SDPParseException - if an error occurs while parsingpublic Object clone()
clone in interface Fieldclone in class Objectpublic Date getStartTime()
public Date getStopTime()
public char getType()
getType in interface Fieldpublic boolean isZero()
public void setStartTime(Date start)
                  throws SDPException
start - the start time
SDPException - if the date is null or if his NTP
         representation is negative
public void setStartTime(long start)
                  throws SDPException
start - The start time
SDPException - If the start time is negative
public void setStopTime(Date stop)
                 throws SDPException
stop - the stop time
SDPException - if the date is null or his NTP
         representation is negative
public void setStopTime(long stop)
                 throws SDPException
stop - the stop time
SDPException - if the stop time is negativepublic void setZero()
public String toString()
toString in interface FieldtoString in class Object
  | 
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||