flushInfoHeaders method

ByteBuffer flushInfoHeaders(
  1. Infos info,
  2. Map<String, String> headers
)

写入表头

Implementation

nio.ByteBuffer flushInfoHeaders(Infos info, Map<String, String> headers) {
  nio.ByteBuffer infoData =
      nio.ByteBuffer.allocate(getWriteHeadersSize(headers));
  if (headers.isNotEmpty) {
    writeVarint(infoData, info.value);
    writeVarint(infoData, headers.length);
    for (var pairs in headers.entries) {
      writeString(infoData, pairs.key);
      writeString(infoData, pairs.value);
    }
    headers.clear();
  }
  infoData.limit = infoData.position;
  infoData.position = 0;
  return infoData;
}