Examples of CharSegment


Examples of com.caucho.util.CharSegment

   *
   * @return the value of the header as an integer.
   */
  public int getIntHeader(String key)
  {
    CharSegment value = getHeaderBuffer(key);

    if (value == null)
      return -1;

    int len = value.length();
    if (len == 0)
      throw new NumberFormatException(value.toString());

    int iValue = 0;
    int i = 0;
    int ch = value.charAt(i);
    int sign = 1;
    if (ch == '+') {
      if (i + 1 < len)
        ch = value.charAt(++i);
      else
        throw new NumberFormatException(value.toString());
    } else if (ch == '-') {
      sign = -1;
      if (i + 1 < len)
        ch = value.charAt(++i);
      else
        throw new NumberFormatException(value.toString());
    }

    for (; i < len && (ch = value.charAt(i)) >= '0' && ch <= '9'; i++)
      iValue = 10 * iValue + ch - '0';

    if (i < len)
      throw new NumberFormatException(value.toString());

    return sign * iValue;
  }
View Full Code Here

Examples of com.caucho.util.CharSegment

  public String getCharacterEncoding()
  {
    if (_readEncoding != null)
      return _readEncoding;

    CharSegment value = getHeaderBuffer("Content-Type");

    if (value == null)
      return null;

    int i = value.indexOf("charset");
    if (i < 0)
      return null;

    int len = value.length();
    for (i += 7; i < len && Character.isWhitespace(value.charAt(i)); i++) {
    }

    if (i >= len || value.charAt(i) != '=')
      return null;

    for (i++; i < len && Character.isWhitespace(value.charAt(i)); i++) {
    }

    if (i >= len)
      return null;

    char end = value.charAt(i);
    if (end == '"') {
      int tail;
      for (tail = ++i; tail < len; tail++) {
        if (value.charAt(tail) == end)
          break;
      }

      _readEncoding = Encoding.getMimeName(value.substring(i, tail));

      return _readEncoding;
    }

    int tail;
    for (tail = i; tail < len; tail++) {
      if (Character.isWhitespace(value.charAt(tail))
          || value.charAt(tail) == ';')
        break;
    }

    _readEncoding = Encoding.getMimeName(value.substring(i, tail));

    return _readEncoding;
  }
View Full Code Here

Examples of org.nutz.lang.segment.CharSegment

  public static Condition wrap(String str) {
    return new SimpleCondition((Object) str);
  }

  public static Condition wrap(String sql, Object value) {
    return new SimpleCondition(new CharSegment(sql).setBy(value));
  }
View Full Code Here

Examples of org.nutz.lang.segment.CharSegment

import org.nutz.lang.segment.CharSegment;

public abstract class EntityName {

  public static EntityName create(String s) {
    CharSegment seg = new CharSegment(s);
    if (seg.keys().size() > 0)
      return new DynamicEntityName(seg);
    return new StaticEntityName(s);
  }
View Full Code Here

Examples of org.nutz.lang.segment.CharSegment

        sts.add(Sqls.create(sql));
    return sts;
  }

  protected static String gSQL(String ptn, String table, String field) {
    CharSegment cs = new CharSegment(ptn);
    cs.set("T", table).set("F", field);
    return cs.toString();
  }
View Full Code Here

Examples of org.nutz.lang.segment.CharSegment

        ef.setAsCompositePk();
    }

    // 默认值
    if (null != info.annDefault)
      ef.setDefaultValue(new CharSegment(info.annDefault.value()));

    // 只读
    if (null != info.annReadonly)
      ef.setAsReadonly();
View Full Code Here

Examples of org.nutz.lang.segment.CharSegment

          }

          // 将本地化字符串增加到当前语言
          for (String key : p.keySet()) {
            String str = p.get(key);
            Segment seg = (new CharSegment()).valueOf(str);
            if (seg.keys().isEmpty())
              msgs.put(key, str);
            else
              msgs.put(key, seg);
          }
View Full Code Here

Examples of org.nutz.lang.segment.CharSegment

  private Map<String, El> exps;

  public AbstractPathView(String dest) {
    if (null != dest) {
      this.dest = new CharSegment(Strings.trim(dest));
      this.exps = new HashMap<String, El>();
      // 预先将每个占位符解析成表达式
      for (String key : this.dest.keys()) {
        this.exps.put(key, new El(key));
      }
View Full Code Here

Examples of org.nutz.lang.segment.CharSegment

                sts.add(Sqls.create(sql));
        return sts;
    }

    protected static String gSQL(String ptn, String table, String field) {
        CharSegment cs = new CharSegment(ptn);
        cs.set("T", table).set("F", field);
        return cs.toString();
    }
View Full Code Here

Examples of org.nutz.lang.segment.CharSegment

                ef.setAsCompositePk();
        }

        // 默认值
        if (null != info.annDefault)
            ef.setDefaultValue(new CharSegment(info.annDefault.value()));

        // 只读
        if (null != info.annReadonly)
            ef.setAsReadonly();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.