void StreamEncoderImpl::encodeData(Buffer::Instance& data, bool end_stream) {
  // end_stream may be indicated with a zero length data buffer. If that is the case, so not
  // actually write the zero length buffer out.
  if (data.length() > 0) {
    if (chunk_encoding_) {
      std::string chunk_header = absl::StrCat(absl::Hex(data.length()), CRLF);
      connection_.buffer().add(std::move(chunk_header));
    }

    connection_.buffer().move(data);

    if (chunk_encoding_) {
      connection_.buffer().add(CRLF);
    }
  }

  if (end_stream) {
    endEncode();
  } else {
    flushOutput();
  }
}
void StreamEncoderImpl::encodeData(Buffer::Instance& data, bool end_stream) {
   
   
  if (data.length() > 0) {
    if (chunk_encoding_) {
      std::string chunk_header = absl::StrCat(absl::Hex(data.length()), CRLF);
      connection_.buffer().add(std::move(chunk_header));
    }

    connection_.buffer().move(data);

    if (chunk_encoding_) {
      connection_.buffer().add(CRLF);
    }
  }

  if (end_stream) {
    endEncode();
  } else {
    flushOutput();
  }
}