Package tkuri.uty

Examples of tkuri.uty.Buf



  @Override
  public String toString() {

    Buf buf = new Buf();

    buf.appendAll("<<", host, ":" + port + ">> ", method, " ", path.sub(0, 32));
    if (headerInfo != null && headerInfo.connectionClose) {
      buf.appendAll(" (conn:close)");
    }

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


  /*
   *
   */
  static ByteBuffer makeRequestHeaderBuffer(ClientRequest aReq) {

    Buf buf = new Buf();

    buf.appendAll(aReq.method, SP, aReq.path, SP, HTTPVER, CRLF);

    buildHeaderBuffer(buf, aReq.headerList, aReq.headerInfo);

    buf.append(CRLF);

    return bufToByteBuf(buf);
  }
View Full Code Here

  /*
   *
   */
  static ByteBuffer makeResponseHeaderBuffer(OriginResponse aRes, boolean aConnClose) {

    Buf buf = new Buf();

    buf.appendAll(aRes.statusLine);

    buildHeaderBuffer(buf, aRes.headerList, aRes.headerInfo);
    if (aConnClose) {
      buf.appendAll(Const.S_CONNECTION, COLON_SP, Const.S_CLOSE, CRLF);
    }

    buf.append(CRLF);

    return bufToByteBuf(buf);
  }
View Full Code Here

      } else if (hp.name.equalsIgnoreCase(Const.S_CONTENT_TYPE)) { // Content-Type
        for (Bs params: Util.splitTrim(hp.value, ';')) {
          Bs[] kv = Util.parseKeyValue(params);
          if (kv[0].equalsIgnoreCase(Const.S_BOUNDARY)) {
            Buf border = new Buf();
            border.appendAll(
                Const.L_HYP2
                , kv[1]
                , Const.L_HYP2);
            multipartFinalBorder = border.toBs();
          }
        }

      } else if (hp.name.equalsIgnoreCase(Const.S_CONTENT_LENGTH)) { // Content-Length
        contentLength = hp.value.toLong();
View Full Code Here

   * @param sDelim
   * @return 存在しなければ null
   */
  public Bs value(Bs aName, int aDelim) {

    Buf buf = new Buf();

    for (HeaderPair hp: list_) {
      if (hp.name.equalsIgnoreCase(aName)) {

        if (0 < buf.length() && aDelim != 0) {
          buf.append(aDelim);
        }

        buf.append(hp.value);
      }
    }

    return buf.toBs();
  }
View Full Code Here

TOP

Related Classes of tkuri.uty.Buf

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.