当前位置: 首页>>代码示例>>Java>>正文


Java TimeZoneImplementation类代码示例

本文整理汇总了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;
}
 
开发者ID:tomatsu,项目名称:squawk,代码行数:21,代码来源:TimeZone.java

示例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;
    }
 
开发者ID:tomatsu,项目名称:squawk,代码行数:37,代码来源:TimeZone.java

示例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();
}
 
开发者ID:tomatsu,项目名称:squawk,代码行数:9,代码来源:TimeZone.java


注:本文中的com.sun.cldc.util.TimeZoneImplementation类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。