INNER CODE UNIT · Java
putHeader
michel-kraemer/bson4jackson · src/main/java/de/undercouch/bson4jackson/BsonGenerator.java:252
protected void putHeader(int pos) {
_buffer.putInt(pos, _buffer.size() - pos);
}
@Override
public void flush() {
try {
// we must not flush the buffer if we are currently writing a document
// otherwise we cannot write the document size to the header at the end
if (_currentDocument == null) {
_buffer.writeTo(_out);
_buffer.clear();
}
_out.flush();
} catch (IOException e) {
throw _wrapIOFailure(e);
}
}