| 72 | } |
| 73 | |
| 74 | Status InputBuffer::ReadNBytes(int64 bytes_to_read, string* result) { |
| 75 | result->clear(); |
| 76 | if (bytes_to_read < 0) { |
| 77 | return errors::InvalidArgument("Can't read a negative number of bytes: ", |
| 78 | bytes_to_read); |
| 79 | } |
| 80 | result->resize(bytes_to_read); |
| 81 | size_t bytes_read = 0; |
| 82 | Status status = ReadNBytes(bytes_to_read, &(*result)[0], &bytes_read); |
| 83 | if (bytes_read < bytes_to_read) result->resize(bytes_read); |
| 84 | return status; |
| 85 | } |
| 86 | |
| 87 | Status InputBuffer::ReadNBytes(int64 bytes_to_read, char* result, |
| 88 | size_t* bytes_read) { |