本文整理匯總了Java中com.sun.cldc.util.TimeZoneImplementation類的典型用法代碼示例。如果您正苦於以下問題:Java TimeZoneImplementation類的具體用法?Java TimeZoneImplementation怎麽用?Java TimeZoneImplementation使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
TimeZoneImplementation類屬於com.sun.cldc.util包,在下文中一共展示了TimeZoneImplementation類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getTimeZone
import com.sun.cldc.util.TimeZoneImplementation; //導入依賴的package包/類
/**
* Gets the <code>TimeZone</code> for the given ID.
* @param ID the ID for a <code>TimeZone</code>, either an abbreviation such as
* "GMT", or a full name such as "America/Los_Angeles".
* <p> The only time zone ID that is required to be supported is "GMT".
*
* @return the specified TimeZone, or the GMT zone if the given ID cannot be
* understood.
*/
public static synchronized TimeZone getTimeZone(String ID) {
if (ID == null) {
throw new NullPointerException();
}
getDefault();
TimeZone tz = ((TimeZoneImplementation)defaultZone).getInstance(ID);
if (tz == null) {
tz = ((TimeZoneImplementation)defaultZone).getInstance("GMT");
}
return tz;
}
示例2: getDefault
import com.sun.cldc.util.TimeZoneImplementation; //導入依賴的package包/類
/**
* Gets the default <code>TimeZone</code> for this host.
* The source of the default <code>TimeZone</code>
* may vary with implementation.
* @return a default <code>TimeZone</code>.
*/
/* <p>
* The following is information for implementers. Applications
* should not need to be aware of this or rely on it, because
* each implementation may do it differently:
* <p>
* The TimeZone class will look up a time zone implementation
* class at runtime. The class name will take the form:
* <p>
* <code>{classRoot}.util.{platform}.TimeZoneImpl</code>
* <p>
* To simplify things, we use a hard-coded path name here.
* Actual location of the implementation class may vary
* from one implementation to another.
*/
public static synchronized TimeZone getDefault() {
if ( defaultZone == null ) {
try {
/*if[GMT_ONLY]*/
defaultZone = new com.sun.cldc.util.j2me.GMTImpl();
/*else[GMT_ONLY]*/
// defaultZone = new com.sun.cldc.util.j2me.TimeZoneImpl();
/*end[GMT_ONLY]*/
// Construct a new TimeZoneImplementation instance
defaultZone = ((TimeZoneImplementation)defaultZone).getInstance(null);
}
catch (Exception x) {}
}
return defaultZone;
}
示例3: getAvailableIDs
import com.sun.cldc.util.TimeZoneImplementation; //導入依賴的package包/類
/**
* Gets all the available IDs supported.
* @return an array of IDs.
*/
public static String[] getAvailableIDs() {
getDefault();
return ((TimeZoneImplementation)defaultZone).getIDs();
}