| 165 | } |
| 166 | |
| 167 | HashStringAllocator::Position HashStringAllocator::newWrite( |
| 168 | ByteOutputStream& stream, |
| 169 | int32_t preferredSize) { |
| 170 | BOLT_CHECK( |
| 171 | !currentHeader_, |
| 172 | "Do not call newWrite before finishing the previous write to " |
| 173 | "HashStringAllocator"); |
| 174 | currentHeader_ = allocate(preferredSize, false); |
| 175 | |
| 176 | stream.setRange( |
| 177 | ByteRange{ |
| 178 | reinterpret_cast<uint8_t*>(currentHeader_->begin()), |
| 179 | currentHeader_->size(), |
| 180 | 0}, |
| 181 | 0); |
| 182 | |
| 183 | startPosition_ = Position::atOffset(currentHeader_, 0); |
| 184 | |
| 185 | return startPosition_; |
| 186 | } |
| 187 | |
| 188 | void HashStringAllocator::extendWrite( |
| 189 | Position position, |