Examples of Buf


Examples of io.netty.buffer.Buf

        } else {
            executor = null;
        }

        if (handler instanceof ChannelInboundHandler) {
            Buf buf;
            try {
                buf = ((ChannelInboundHandler) handler).newInboundBuffer(this);
            } catch (Exception e) {
                throw new ChannelPipelineException(
                        handler.getClass().getSimpleName() + ".newInboundBuffer() raised an exception.", e);
            }

            if (buf instanceof ByteBuf) {
                inByteBuf = (ByteBuf) buf;
                inMsgBuf = null;
            } else if (buf instanceof MessageBuf) {
                inMsgBuf = (MessageBuf<Object>) buf;
                inByteBuf = null;
            } else {
                throw new ChannelPipelineException(
                        handler.getClass().getSimpleName() + ".newInboundBuffer() returned neither " +
                        ByteBuf.class.getSimpleName() + " nor " + MessageBuf.class.getSimpleName() + ": " + buf);
            }
        } else {
            inByteBuf = null;
            inMsgBuf = null;
        }

        if (handler instanceof ChannelOutboundHandler) {
            Buf buf;
            try {
                buf = ((ChannelOutboundHandler) handler).newOutboundBuffer(this);
            } catch (Exception e) {
                throw new ChannelPipelineException(
                        handler.getClass().getSimpleName() + ".newOutboundBuffer() raised an exception.", e);
View Full Code Here

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

Examples of tkuri.uty.Buf

  /*
   *
   */
  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

Examples of tkuri.uty.Buf

  /*
   *
   */
  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

Examples of tkuri.uty.Buf

      } 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

Examples of tkuri.uty.Buf

   * @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
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.