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


Java Util.toASCIILowerCase方法代码示例

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


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

示例1: decodeActions

import org.apache.harmony.luni.util.Util; //导入方法依赖的package包/类
private void decodeActions(String actions) {
    StringTokenizer tokenizer = new StringTokenizer(Util.toASCIILowerCase(actions),
            " \t\n\r,");
    while (tokenizer.hasMoreTokens()) {
        String token = tokenizer.nextToken();
        if (token.equals("read")) {
            read = true;
        } else if (token.equals("write")) {
            write = true;
        } else {
            throw new IllegalArgumentException();
        }
    }
    if (!read && !write) {
        throw new IllegalArgumentException();
    }
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:18,代码来源:PropertyPermission.java

示例2: decodeActions

import org.apache.harmony.luni.util.Util; //导入方法依赖的package包/类
private void decodeActions(String actions) {
    StringTokenizer tokenizer = new StringTokenizer(Util.toASCIILowerCase(actions),
            " \t\n\r,"); //$NON-NLS-1$
    while (tokenizer.hasMoreTokens()) {
        String token = tokenizer.nextToken();
        if (token.equals("read")) { //$NON-NLS-1$
            read = true;
        } else if (token.equals("write")) { //$NON-NLS-1$
            write = true;
        } else {
            throw new IllegalArgumentException();
        }
    }
    if (!read && !write) {
        throw new IllegalArgumentException();
    }
}
 
开发者ID:shannah,项目名称:cn1,代码行数:18,代码来源:PropertyPermission.java

示例3: Locale

import org.apache.harmony.luni.util.Util; //导入方法依赖的package包/类
/**
 * Constructs a new Locale using the specified language, country, and
 * variant codes.
 * 
 * @param language
 * @param country
 * @param variant
 * @throws NullPointerException if <code>language</code>,
 *         <code>country</code> or <code>variant</code> is
 *         <code>null</code>.
 */
public Locale(String language, String country, String variant) {
    if (language == null || country == null || variant == null) {
        throw new NullPointerException();
    }
    languageCode = Util.toASCIILowerCase(language);
    // Map new language codes to the obsolete language
    // codes so the correct resource bundles will be used.
    if (languageCode.equals("he")) {//$NON-NLS-1$
        languageCode = "iw"; //$NON-NLS-1$
    } else if (languageCode.equals("id")) {//$NON-NLS-1$
        languageCode = "in"; //$NON-NLS-1$
    } else if (languageCode.equals("yi")) {//$NON-NLS-1$
        languageCode = "ji"; //$NON-NLS-1$
    }

    // countryCode is defined in ASCII character set
    countryCode = Util.toASCIIUpperCase(country);

    variantCode = variant;
}
 
开发者ID:freeVM,项目名称:freeVM,代码行数:32,代码来源:Locale.java

示例4: Locale

import org.apache.harmony.luni.util.Util; //导入方法依赖的package包/类
/**
 * Constructs a new {@code Locale} using the specified language, country,
 * and variant codes.
 */
public Locale(String language, String country, String variant) {
    if (language == null || country == null || variant == null) {
        throw new NullPointerException();
    }
    if(language.isEmpty() && country.isEmpty()){
        languageCode = "";
        countryCode = "";
        variantCode = variant;
        return;
    }
    // BEGIN android-changed
    // this.uLocale = new ULocale(language, country, variant);
    // languageCode = uLocale.getLanguage();
    languageCode = Util.toASCIILowerCase(language);
    // END android-changed
    // Map new language codes to the obsolete language
    // codes so the correct resource bundles will be used.
    if (languageCode.equals("he")) {
        languageCode = "iw";
    } else if (languageCode.equals("id")) {
        languageCode = "in";
    } else if (languageCode.equals("yi")) {
        languageCode = "ji";
    }

    // countryCode is defined in ASCII character set
    // BEGIN android-changed
    // countryCode = country.length()!=0?uLocale.getCountry():"";
    countryCode = Util.toASCIIUpperCase(country);
    // END android-changed

    // Work around for be compatible with RI
    variantCode = variant;
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:39,代码来源:Locale.java

示例5: setActions

import org.apache.harmony.luni.util.Util; //导入方法依赖的package包/类
/**
 * Stores the actions for this permission as a bit field.
 * 
 * @param actions
 *            java.lang.String the action list
 */
private void setActions(String actions) throws IllegalArgumentException {
    if (actions.equals("")) { //$NON-NLS-1$
        return;
    }
    boolean parsing = true;
    String action;
    StringBuilder sb = new StringBuilder();
    int pos = 0, length = actions.length();
    while (parsing) {
        char c;
        sb.setLength(0);
        while (pos < length && (c = actions.charAt(pos++)) != ',') {
            sb.append(c);
        }
        if (pos == length) {
            parsing = false;
        }
        action = Util.toASCIILowerCase(sb.toString().trim());
        if (action.equals(actionNames[SP_CONNECT])) {
            actionsMask |= SP_CONNECT;
        } else if (action.equals(actionNames[SP_LISTEN])) {
            actionsMask |= SP_LISTEN;
        } else if (action.equals(actionNames[SP_ACCEPT])) {
            actionsMask |= SP_ACCEPT;
        } else if (action.equals(actionNames[SP_RESOLVE])) {
            // do nothing
        } else {
            throw new IllegalArgumentException(Messages.getString("luni.7A", //$NON-NLS-1$
                    action));
        }
    }
}
 
开发者ID:shannah,项目名称:cn1,代码行数:39,代码来源:SocketPermission.java

示例6: toCanonicalActionString

import org.apache.harmony.luni.util.Util; //导入方法依赖的package包/类
/**
 * Returns the string representing this permission's actions. It must be of
 * the form "read,write,execute,delete", all lower case and in the correct
 * order if there is more than one action.
 * 
 * @param action
 *            the action name
 * @return the string representing this permission's actions
 */
private String toCanonicalActionString(String action) {
    actions = Util.toASCIILowerCase(action.trim());

    // get the numerical representation of the action list
    mask = getMask(actions);

    // convert the mask to a canonical action list.
    int len = actionList.length;
    // the test mask - shift the 1 to the leftmost position of the
    // actionList
    int highestBitMask = 1 << (len - 1);

    // if a bit of mask is set, append the corresponding action to result
    StringBuilder result = new StringBuilder();
    boolean addedItem = false;
    for (int i = 0; i < len; i++) {
        if ((highestBitMask & mask) != 0) {
            if (addedItem) {
                result.append(","); //$NON-NLS-1$
            }
            result.append(actionList[i]);
            addedItem = true;
        }
        highestBitMask = highestBitMask >> 1;
    }
    return result.toString();
}
 
开发者ID:freeVM,项目名称:freeVM,代码行数:37,代码来源:FilePermission.java


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