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


Java StringUtils.cache方法代码示例

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


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

示例1: get

import org.h2.util.StringUtils; //导入方法依赖的package包/类
/**
 * Get or create a fixed length string value for the given string.
 * Spaces at the end of the string will be removed.
 *
 * @param s the string
 * @return the value
 */
public static ValueStringFixed get(String s) {
    s = trimRight(s);
    if (s.length() == 0) {
        return EMPTY;
    }
    ValueStringFixed obj = new ValueStringFixed(StringUtils.cache(s));
    if (s.length() > SysProperties.OBJECT_CACHE_MAX_PER_ELEMENT_SIZE) {
        return obj;
    }
    return (ValueStringFixed) Value.cache(obj);
}
 
开发者ID:vdr007,项目名称:ThriftyPaxos,代码行数:19,代码来源:ValueStringFixed.java

示例2: readString

import org.h2.util.StringUtils; //导入方法依赖的package包/类
/**
 * Read a string.
 *
 * @return the value
 */
public String readString() throws IOException {
    int len = in.readInt();
    if (len == -1) {
        return null;
    }
    StringBuilder buff = new StringBuilder(len);
    for (int i = 0; i < len; i++) {
        buff.append(in.readChar());
    }
    String s = buff.toString();
    s = StringUtils.cache(s);
    return s;
}
 
开发者ID:vdr007,项目名称:ThriftyPaxos,代码行数:19,代码来源:Transfer.java

示例3: get

import org.h2.util.StringUtils; //导入方法依赖的package包/类
/**
 * Get or create a string value for the given string.
 *
 * @param s the string
 * @param treatEmptyStringsAsNull whether or not to treat empty strings as
 *            NULL
 * @return the value
 */
public static Value get(String s, boolean treatEmptyStringsAsNull) {
    if (s.isEmpty()) {
        return treatEmptyStringsAsNull ? ValueNull.INSTANCE : EMPTY;
    }
    ValueString obj = new ValueString(StringUtils.cache(s));
    if (s.length() > SysProperties.OBJECT_CACHE_MAX_PER_ELEMENT_SIZE) {
        return obj;
    }
    return Value.cache(obj);
    // this saves memory, but is really slow
    // return new ValueString(s.intern());
}
 
开发者ID:vdr007,项目名称:ThriftyPaxos,代码行数:21,代码来源:ValueString.java

示例4: tokenize

import org.h2.util.StringUtils; //导入方法依赖的package包/类
private String[] tokenize() {
    ArrayList<String> list = New.arrayList();
    syntax = StringUtils.replaceAll(syntax, "yyyy-MM-dd", "@[email protected]");
    syntax = StringUtils.replaceAll(syntax, "hh:mm:ss", "@[email protected]");
    syntax = StringUtils.replaceAll(syntax, "nnnnnnnnn", "@[email protected]");
    syntax = StringUtils.replaceAll(syntax, "function", "@[email protected]");
    syntax = StringUtils.replaceAll(syntax, "0x", "@[email protected]");
    syntax = StringUtils.replaceAll(syntax, ",...", "@[email protected]");
    syntax = StringUtils.replaceAll(syntax, "...", "@[email protected]");
    syntax = StringUtils.replaceAll(syntax, "||", "@[email protected]");
    syntax = StringUtils.replaceAll(syntax, "a-z|_", "@[email protected]");
    syntax = StringUtils.replaceAll(syntax, "A-Z|_", "@[email protected]");
    syntax = StringUtils.replaceAll(syntax, "A-F", "@[email protected]");
    syntax = StringUtils.replaceAll(syntax, "0-9", "@[email protected]");
    syntax = StringUtils.replaceAll(syntax, "'['", "@[email protected]");
    syntax = StringUtils.replaceAll(syntax, "']'", "@[email protected]");
    StringTokenizer tokenizer = getTokenizer(syntax);
    while (tokenizer.hasMoreTokens()) {
        String s = tokenizer.nextToken();
        // avoid duplicate strings
        s = StringUtils.cache(s);
        if (s.length() == 1) {
            if (" \r\n".indexOf(s.charAt(0)) >= 0) {
                continue;
            }
        }
        list.add(s);
    }
    return list.toArray(new String[list.size()]);
}
 
开发者ID:vdr007,项目名称:ThriftyPaxos,代码行数:31,代码来源:Bnf.java


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