| 82 | } |
| 83 | |
| 84 | void TCodedOutput::DoWrite(const void* buf, size_t len) { |
| 85 | const char* in = (const char*)buf; |
| 86 | |
| 87 | while (len) { |
| 88 | const size_t avail = D_.Avail(); |
| 89 | |
| 90 | if (len < avail) { |
| 91 | D_.Append(in, len); |
| 92 | |
| 93 | return; |
| 94 | } |
| 95 | |
| 96 | D_.Append(in, avail); |
| 97 | |
| 98 | Y_ASSERT(!D_.Avail()); |
| 99 | |
| 100 | in += avail; |
| 101 | len -= avail; |
| 102 | |
| 103 | Y_ABORT_UNLESS(FlushImpl(), "flush on writing failed"); |
| 104 | } |
| 105 | } |
| 106 | |
| 107 | bool TCodedOutput::FlushImpl() { |
| 108 | const bool ret = !D_.Empty(); |