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


Java ULocale.forLanguageTag方法代码示例

本文整理汇总了Java中com.ibm.icu.util.ULocale.forLanguageTag方法的典型用法代码示例。如果您正苦于以下问题:Java ULocale.forLanguageTag方法的具体用法?Java ULocale.forLanguageTag怎么用?Java ULocale.forLanguageTag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.ibm.icu.util.ULocale的用法示例。


在下文中一共展示了ULocale.forLanguageTag方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: readExternal

import com.ibm.icu.util.ULocale; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
    in.readByte(); // version.
    locale = ULocale.forLanguageTag(in.readUTF());
    formatWidth = fromFormatWidthOrdinal(in.readByte() & 0xFF);
    numberFormat = (NumberFormat) in.readObject();
    if (numberFormat == null) {
        throw new InvalidObjectException("Missing number format.");
    }
    subClass = in.readByte() & 0xFF;

    // This cast is safe because the serialized form of hashtable can have
    // any object as the key and any object as the value.
    keyValues = (HashMap<Object, Object>) in.readObject();
    if (keyValues == null) {
        throw new InvalidObjectException("Missing optional values map.");
    }
}
 
开发者ID:abhijitvalluri,项目名称:fitnotifications,代码行数:19,代码来源:MeasureFormat.java

示例2: readObject

import com.ibm.icu.util.ULocale; //导入方法依赖的package包/类
/**
 * Custom deserialization, new in ICU 4.8. See comments on writeObject().
 * @throws InvalidObjectException if the objects read from the stream is invalid.
 */
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
    in.defaultReadObject();
    // ICU 4.8 custom deserialization.
    String languageTag = (String)in.readObject();
    ulocale = ULocale.forLanguageTag(languageTag);
    MessagePattern.ApostropheMode aposMode = (MessagePattern.ApostropheMode)in.readObject();
    if (msgPattern == null || aposMode != msgPattern.getApostropheMode()) {
        msgPattern = new MessagePattern(aposMode);
    }
    String msg = (String)in.readObject();
    if (msg != null) {
        applyPattern(msg);
    }
    // custom formatters
    for (int numFormatters = in.readInt(); numFormatters > 0; --numFormatters) {
        int formatIndex = in.readInt();
        Format formatter = (Format)in.readObject();
        setFormat(formatIndex, formatter);
    }
    // skip future (int, Object) pairs
    for (int numPairs = in.readInt(); numPairs > 0; --numPairs) {
        in.readInt();
        in.readObject();
    }
}
 
开发者ID:abhijitvalluri,项目名称:fitnotifications,代码行数:30,代码来源:MessageFormat.java


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