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


Java LocaleSyntaxException.getErrorIndex方法代码示例

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


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

示例1: setLocale

import sun.util.locale.LocaleSyntaxException; //导入方法依赖的package包/类
/**
 * Resets the <code>Builder</code> to match the provided
 * <code>locale</code>.  Existing state is discarded.
 *
 * <p>All fields of the locale must be well-formed, see {@link Locale}.
 *
 * <p>Locales with any ill-formed fields cause
 * <code>IllformedLocaleException</code> to be thrown, except for the
 * following three cases which are accepted for compatibility
 * reasons:<ul>
 * <li>Locale("ja", "JP", "JP") is treated as "ja-JP-u-ca-japanese"
 * <li>Locale("th", "TH", "TH") is treated as "th-TH-u-nu-thai"
 * <li>Locale("no", "NO", "NY") is treated as "nn-NO"</ul>
 *
 * @param locale the locale
 * @return This builder.
 * @throws IllformedLocaleException if <code>locale</code> has
 * any ill-formed fields.
 * @throws NullPointerException if <code>locale</code> is null.
 */
public Builder setLocale(Locale locale) {
    try {
        localeBuilder.setLocale(locale.baseLocale, locale.localeExtensions);
    } catch (LocaleSyntaxException e) {
        throw new IllformedLocaleException(e.getMessage(), e.getErrorIndex());
    }
    return this;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:29,代码来源:Locale.java

示例2: setRegion

import sun.util.locale.LocaleSyntaxException; //导入方法依赖的package包/类
/**
 * Sets the region.  If region is null or the empty string, the region
 * in this <code>Builder</code> is removed.  Otherwise,
 * the region must be <a href="./Locale.html#def_region">well-formed</a> or an
 * exception is thrown.
 *
 * <p>The typical region value is a two-letter ISO 3166 code or a
 * three-digit UN M.49 area code.
 *
 * <p>The country value in the <code>Locale</code> created by the
 * <code>Builder</code> is always normalized to upper case.
 *
 * @param region the region
 * @return This builder.
 * @throws IllformedLocaleException if <code>region</code> is ill-formed
 */
public Builder setRegion(String region) {
    try {
        localeBuilder.setRegion(region);
    } catch (LocaleSyntaxException e) {
        throw new IllformedLocaleException(e.getMessage(), e.getErrorIndex());
    }
    return this;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:25,代码来源:Locale.java

示例3: setScript

import sun.util.locale.LocaleSyntaxException; //导入方法依赖的package包/类
/**
 * Sets the script. If <code>script</code> is null or the empty string,
 * the script in this <code>Builder</code> is removed.
 * Otherwise, the script must be <a href="./Locale.html#def_script">well-formed</a> or an
 * exception is thrown.
 *
 * <p>The typical script value is a four-letter script code as defined by ISO 15924.
 *
 * @param script the script
 * @return This builder.
 * @throws IllformedLocaleException if <code>script</code> is ill-formed
 */
public Builder setScript(String script) {
    try {
        localeBuilder.setScript(script);
    } catch (LocaleSyntaxException e) {
        throw new IllformedLocaleException(e.getMessage(), e.getErrorIndex());
    }
    return this;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:21,代码来源:Locale.java

示例4: setVariant

import sun.util.locale.LocaleSyntaxException; //导入方法依赖的package包/类
/**
 * Sets the variant.  If variant is null or the empty string, the
 * variant in this <code>Builder</code> is removed.  Otherwise, it
 * must consist of one or more <a href="./Locale.html#def_variant">well-formed</a>
 * subtags, or an exception is thrown.
 *
 * <p><b>Note:</b> This method checks if <code>variant</code>
 * satisfies the IETF BCP 47 variant subtag's syntax requirements,
 * and normalizes the value to lowercase letters.  However,
 * the <code>Locale</code> class does not impose any syntactic
 * restriction on variant, and the variant value in
 * <code>Locale</code> is case sensitive.  To set such a variant,
 * use a Locale constructor.
 *
 * @param variant the variant
 * @return This builder.
 * @throws IllformedLocaleException if <code>variant</code> is ill-formed
 */
public Builder setVariant(String variant) {
    try {
        localeBuilder.setVariant(variant);
    } catch (LocaleSyntaxException e) {
        throw new IllformedLocaleException(e.getMessage(), e.getErrorIndex());
    }
    return this;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:27,代码来源:Locale.java

示例5: setExtension

import sun.util.locale.LocaleSyntaxException; //导入方法依赖的package包/类
/**
 * Sets the extension for the given key. If the value is null or the
 * empty string, the extension is removed.  Otherwise, the extension
 * must be <a href="./Locale.html#def_extensions">well-formed</a> or an exception
 * is thrown.
 *
 * <p><b>Note:</b> The key {@link Locale#UNICODE_LOCALE_EXTENSION
 * UNICODE_LOCALE_EXTENSION} ('u') is used for the Unicode locale extension.
 * Setting a value for this key replaces any existing Unicode locale key/type
 * pairs with those defined in the extension.
 *
 * <p><b>Note:</b> The key {@link Locale#PRIVATE_USE_EXTENSION
 * PRIVATE_USE_EXTENSION} ('x') is used for the private use code. To be
 * well-formed, the value for this key needs only to have subtags of one to
 * eight alphanumeric characters, not two to eight as in the general case.
 *
 * @param key the extension key
 * @param value the extension value
 * @return This builder.
 * @throws IllformedLocaleException if <code>key</code> is illegal
 * or <code>value</code> is ill-formed
 * @see #setUnicodeLocaleKeyword(String, String)
 */
public Builder setExtension(char key, String value) {
    try {
        localeBuilder.setExtension(key, value);
    } catch (LocaleSyntaxException e) {
        throw new IllformedLocaleException(e.getMessage(), e.getErrorIndex());
    }
    return this;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:32,代码来源:Locale.java

示例6: setUnicodeLocaleKeyword

import sun.util.locale.LocaleSyntaxException; //导入方法依赖的package包/类
/**
 * Sets the Unicode locale keyword type for the given key.  If the type
 * is null, the Unicode keyword is removed.  Otherwise, the key must be
 * non-null and both key and type must be <a
 * href="./Locale.html#def_locale_extension">well-formed</a> or an exception
 * is thrown.
 *
 * <p>Keys and types are converted to lower case.
 *
 * <p><b>Note</b>:Setting the 'u' extension via {@link #setExtension}
 * replaces all Unicode locale keywords with those defined in the
 * extension.
 *
 * @param key the Unicode locale key
 * @param type the Unicode locale type
 * @return This builder.
 * @throws IllformedLocaleException if <code>key</code> or <code>type</code>
 * is ill-formed
 * @throws NullPointerException if <code>key</code> is null
 * @see #setExtension(char, String)
 */
public Builder setUnicodeLocaleKeyword(String key, String type) {
    try {
        localeBuilder.setUnicodeLocaleKeyword(key, type);
    } catch (LocaleSyntaxException e) {
        throw new IllformedLocaleException(e.getMessage(), e.getErrorIndex());
    }
    return this;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:30,代码来源:Locale.java

示例7: addUnicodeLocaleAttribute

import sun.util.locale.LocaleSyntaxException; //导入方法依赖的package包/类
/**
 * Adds a unicode locale attribute, if not already present, otherwise
 * has no effect.  The attribute must not be null and must be <a
 * href="./Locale.html#def_locale_extension">well-formed</a> or an exception
 * is thrown.
 *
 * @param attribute the attribute
 * @return This builder.
 * @throws NullPointerException if <code>attribute</code> is null
 * @throws IllformedLocaleException if <code>attribute</code> is ill-formed
 * @see #setExtension(char, String)
 */
public Builder addUnicodeLocaleAttribute(String attribute) {
    try {
        localeBuilder.addUnicodeLocaleAttribute(attribute);
    } catch (LocaleSyntaxException e) {
        throw new IllformedLocaleException(e.getMessage(), e.getErrorIndex());
    }
    return this;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:21,代码来源:Locale.java

示例8: removeUnicodeLocaleAttribute

import sun.util.locale.LocaleSyntaxException; //导入方法依赖的package包/类
/**
 * Removes a unicode locale attribute, if present, otherwise has no
 * effect.  The attribute must not be null and must be <a
 * href="./Locale.html#def_locale_extension">well-formed</a> or an exception
 * is thrown.
 *
 * <p>Attribute comparision for removal is case-insensitive.
 *
 * @param attribute the attribute
 * @return This builder.
 * @throws NullPointerException if <code>attribute</code> is null
 * @throws IllformedLocaleException if <code>attribute</code> is ill-formed
 * @see #setExtension(char, String)
 */
public Builder removeUnicodeLocaleAttribute(String attribute) {
    try {
        localeBuilder.removeUnicodeLocaleAttribute(attribute);
    } catch (LocaleSyntaxException e) {
        throw new IllformedLocaleException(e.getMessage(), e.getErrorIndex());
    }
    return this;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:23,代码来源:Locale.java

示例9: setLanguage

import sun.util.locale.LocaleSyntaxException; //导入方法依赖的package包/类
/**
 * Sets the language.  If <code>language</code> is the empty string or
 * null, the language in this <code>Builder</code> is removed.  Otherwise,
 * the language must be <a href="./Locale.html#def_language">well-formed</a>
 * or an exception is thrown.
 *
 * <p>The typical language value is a two or three-letter language
 * code as defined in ISO639.
 *
 * @param language the language
 * @return This builder.
 * @throws IllformedLocaleException if <code>language</code> is ill-formed
 */
public Builder setLanguage(String language) {
    try {
        localeBuilder.setLanguage(language);
    } catch (LocaleSyntaxException e) {
        throw new IllformedLocaleException(e.getMessage(), e.getErrorIndex());
    }
    return this;
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:22,代码来源:Locale.java

示例10: removeUnicodeLocaleAttribute

import sun.util.locale.LocaleSyntaxException; //导入方法依赖的package包/类
/**
 * Removes a unicode locale attribute, if present, otherwise has no
 * effect.  The attribute must not be null and must be <a
 * href="./Locale.html#def_locale_extension">well-formed</a> or an exception
 * is thrown.
 *
 * <p>Attribute comparison for removal is case-insensitive.
 *
 * @param attribute the attribute
 * @return This builder.
 * @throws NullPointerException if <code>attribute</code> is null
 * @throws IllformedLocaleException if <code>attribute</code> is ill-formed
 * @see #setExtension(char, String)
 */
public Builder removeUnicodeLocaleAttribute(String attribute) {
    Objects.requireNonNull(attribute);
    try {
        localeBuilder.removeUnicodeLocaleAttribute(attribute);
    } catch (LocaleSyntaxException e) {
        throw new IllformedLocaleException(e.getMessage(), e.getErrorIndex());
    }
    return this;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:24,代码来源:Locale.java


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