@Override
    public void addSegment(final long position) throws IOException {
        if (position < lastBoundary) {
            throw new IOException("The boundary position cannot be less than the previous boundary position.");
        }
        lastBoundary = position;

        // Lazily initialise index output stream provider.
        if (indexOutputStream == null) {
            indexOutputStream = indexOutputStreamSupplier.getWithIO();
            buffer = new byte[LONG_BYTES];
            longBuffer = ByteBuffer.wrap(buffer).asLongBuffer();
        }

        longBuffer.rewind();
        longBuffer.put(position);
        indexOutputStream.write(buffer);
    }
Adds a segment boundary to the output stream at a given byte position.
All bytes written between the start of the output or the last boundary
will be considered a segment by the <code>SegmentInputStream</code>.

@param position The byte position of the end of the segment.
stroom-data/stroom-data-store-impl-fs/src/main/java/stroom/data/store/impl/fs/RASegmentOutputStream.java