本文整理汇总了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();
}