private long byteOffset(final long segment, final boolean lowerBound) throws IOException {
        // start pos ?
        if (lowerBound) {
            if (segment == 0) {
                return 0;
            } else if (segment == totalSegmentCount) {
                return windowByteEnd;
            } else {
                return getOffset(segment - 1);
            }
        } else {
            // end of block
            if (segment == totalSegmentCount) {
                return windowByteEnd;
            } else {
                return getOffset(segment);
            }
        }
    }
@param segment    to find the byte offset of
@param lowerBound if you want the start of the end byte pos
stroom-data/stroom-data-store-impl-fs/src/main/java/stroom/data/store/impl/fs/RASegmentInputStream.java