| 22 | |
| 23 | namespace { |
| 24 | string ToString(const grpc::ByteBuffer& buf) { |
| 25 | std::vector<grpc::Slice> slices; |
| 26 | CHECK(buf.Dump(&slices).ok()); |
| 27 | string result; |
| 28 | for (const grpc::Slice& s : slices) { |
| 29 | result.append(reinterpret_cast<const char*>(s.begin()), s.size()); |
| 30 | } |
| 31 | return result; |
| 32 | } |
| 33 | |
| 34 | // Return a ByteBuffer that contains str split up into num_slices slices. |
| 35 | grpc::ByteBuffer MakeBuffer(const string& str, int num_slices) { |