INNER CODE UNIT · Java

reserveHeader

michel-kraemer/bson4jackson · src/main/java/de/undercouch/bson4jackson/BsonGenerator.java:243

    protected void reserveHeader() {
        _buffer.putInt(0);
    }

    /**
     * Writes the BSON document header to the output buffer at the
     * given position. Does not increase the buffer's write position.
     * @param pos the position where to write the header
     */
    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

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…