private void check(final long segment) {
        if (segment < 0 || segment >= windowSegmentCount) {
            throw new RuntimeException(
                    "Segment number " + segment + " is not within bounds [0-" + windowSegmentCount + "]");
        }

        if (windowPos > windowByteStart) {
            throw new RuntimeException("Cannot include a new segment as reading is in progress");
        }
    }
Checks that no includes or excludes are added once the stream is being
read.
stroom-data/stroom-data-store-impl-fs/src/main/java/stroom/data/store/impl/fs/RASegmentInputStream.java