@Override
    public void close() throws IOException {
        try {
            if (!closed) {
                closed = true;

                if (currentStreamBuffer != null) {
                    // End the data stream
                    endGzipBlock();
                }

                // Record where we are going to start writing the index
                final long idxStart = raFile.position();

                // Append the Index
                raFile.write(ByteBuffer.wrap(indexBuffer.getRawBuffer(), 0, indexBuffer.size()));

                // Now Record the EOF
                final long eof = raFile.size();

                // Seek back to the start to write the above stats.
                // Write the Index Post back in the header
                raFile.position(BlockGZIPConstants.BLOCK_GZIP_V1_IDENTIFIER.length + BlockGZIPConstants.LONG_BYTES);
                // Write the uncompressed stream size

                mainBuffer.reset();
                // Size of Uncompressed Data
                mainBuffer.writeLong(position);
                // And the Index Start POS
                mainBuffer.writeLong(idxStart);
                // And the End File Pos
                mainBuffer.writeLong(eof);

                flushMainBuffer();

                raFile.close();

                try {
                    Files.move(lockFile, finalFile);
                } catch (final IOException e) {
                    throw new IOException("Failed to rename lock file " + lockFile, e);
                }
            }
        } finally {
            try {
                streamCloser.close();
            } finally {
                super.close();
            }
        }
    }
Start a new burst of GZIP Block Content (with a marker).
stroom-data/stroom-data-store-impl-fs/src/main/java/stroom/data/store/impl/fs/BlockGZIPOutputFile.java