bool readBytes()

in hessian2/basic_codec/byte_codec.cc [116:131]


bool readBytes(std::vector<uint8_t> &output, ReaderPtr &reader, size_t length,
               bool is_last_chunk) {
  if (length == 0) {
    return true;
  }
  if (length > reader->byteAvailable()) {
    return false;
  }
  auto offset = output.size();
  output.resize(offset + length);
  reader->readNBytes(&output[offset], length);
  if (is_last_chunk) {
    return true;
  }
  return decodeBytesWithReader(output, reader);
}