Package com.caucho.util

Examples of com.caucho.util.CharBuffer


    HttpServletResponseImpl response = _request.getResponseFacade();

    int statusCode = response.getStatus();

    CharBuffer cb = _cb;
    cb.clear();
    cb.append((char) ((statusCode / 100) % 10 + '0'));
    cb.append((char) ((statusCode / 10) % 10 + '0'));
    cb.append((char) (statusCode % 10 + '0'));
    cb.append(' ');
    cb.append(response.getStatusMessage());

    _req.writeStatus(cb);

    if (statusCode >= 400) {
      removeHeader("ETag");
      removeHeader("Last-Modified");
    }
    else if (response.isNoCache()) {
      removeHeader("ETag");
      removeHeader("Last-Modified");

      setHeader("Expires", "Thu, 01 Dec 1994 16:00:00 GMT");
      _req.writeHeader("Cache-Control", "no-cache");
    }
    else if (response.isPrivateCache())
      _req.writeHeader("Cache-Control", "private");

    int load = (int) (1000 * _req.getServer().getCpuLoad());
    if (Alarm.isTest())
      load = 0;

    _req.writeString(HmuxRequest.HMUX_META_HEADER, "cpu-load");
    _req.writeString(HmuxRequest.HMUX_STRING, String.valueOf(load));

    int size = _headerKeys.size();
    for (int i = 0; i < size; i++) {
      String key = (String) _headerKeys.get(i);
      String value = (String) _headerValues.get(i);

      _req.writeHeader(key, value);
    }

    if (_contentLength >= 0) {
      cb.clear();
      cb.append(_contentLength);
      _req.writeHeader("Content-Length", cb);
    }
    else if (length >= 0) {
      cb.clear();
      cb.append(length);
      _req.writeHeader("Content-Length", cb);
    }

    HttpServletResponseImpl responseFacade = _request.getResponseFacade();

View Full Code Here


                  + (read() << 8)
                  + (read()));

    int len = length >> 1;

    CharBuffer cb = _cb;
    cb.ensureCapacity(len);
    char []cBuf = cb.getBuffer();
    int cLen = 0;

    for (; len > 0; len--) {
      int ch1 = read();
      int ch2 = read();
View Full Code Here

  private String readBlobString()
    throws SQLException
  {
    read(_blob, 0, 128);

    CharBuffer cb = _cb;
    cb.clear();

    BlobInputStream is = null;
    try {
      is = new BlobInputStream(_stores[_column], _blob, 0);

      int ch;
      while ((ch = is.read()) >= 0) {
        if (ch < 0x80)
          cb.append((char) ch);
      }
    } catch (IOException e) {
      throw new SQLExceptionWrapper(e);
    }

    return cb.toString();
  }
View Full Code Here

    _ts = new TempStream();
    _rs = new ReadStream();
    _rs.setReuseBuffer(true);
    _buf = TempBuffer.allocate();
    _buffer = _buf.getBuffer();
    _cb = new CharBuffer();

    _rows = new TableIterator[0];
  }
View Full Code Here

    int offset = _offsets[index];
   
    if (length < 0)
      return null;

    CharBuffer cb = _cb;
    cb.clear();

    byte []buffer = _buffer;
    for (; length > 0; length--) {
      cb.append((char) buffer[offset++]);
    }

    return cb.toString();
  }
View Full Code Here

  {
    _lastColumn = index;
   
    int offset = _offsets[index];

    CharBuffer cb = _cb;
    cb.clear();

    BlobInputStream is = null;
    try {
      is = new BlobInputStream(_stores[index], _buffer, offset);

      int ch;
      while ((ch = is.read()) >= 0) {
        if (ch < 0x80)
          cb.append((char) ch);
      }
    } catch (IOException e) {
      throw new SQLExceptionWrapper(e);
    }

    return cb.toString();
  }
View Full Code Here

      out.print(getNodeValue(node));
  }

  public String getNodeValue(Node node)
  {
    CharBuffer cb = new CharBuffer();

    nodeValue(cb, node);

    return cb.toString();
  }
View Full Code Here

    _topContext = _context;
    _loader = xslGenerator.getClassLoader();
    if (_loader == null)
      _loader = Thread.currentThread().getContextClassLoader();
   
    _text = new CharBuffer();
    _frags = new ArrayList();
    _macros = new HashMap<String,String>();

    _keyFun = new KeyFun();
    _formatNumberFun = new FormatNumberFun();
View Full Code Here

      String name = attr.getNodeName();
      String value = attr.getNodeValue();

      if (name.equals("import")) {
        StringCharCursor cursor = new StringCharCursor(value);
        CharBuffer cb = new CharBuffer();
        while (cursor.current() != cursor.DONE) {
          char ch;
          commaDelimScanner.skip(cursor);

          cb.clear();
          ch = commaDelimScanner.scan(cursor, cb);

          if (cb.length() != 0) {
            addImport(cb.toString());
          }
          else if (ch != cursor.DONE)
            throw new IOException(L.l("illegal `import' directive"));
        }
      }
View Full Code Here

  public void addImportList(String value)
    throws XslParseException
  {
    StringCharCursor cursor = new StringCharCursor(value);
    CharBuffer cb = new CharBuffer();
    while (cursor.current() != cursor.DONE) {
      char ch;
      commaDelimScanner.skip(cursor);

      cb.clear();
      ch = commaDelimScanner.scan(cursor, cb);

      if (cb.length() != 0) {
        addImport(cb.toString());
      }
      else if (ch != cursor.DONE)
        throw error(L.l("illegal `import' directive"));
    }
  }
View Full Code Here

TOP

Related Classes of com.caucho.util.CharBuffer

Copyright © 2018 www.massapicom. 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.