/** Finds compressed offset in a stream and makes sure iter points to its position. This may be necessary for obscure combinations of compression and encoding boundaries. */ private static DiskRangeList findExactPosition(DiskRangeList ranges, long offset) { if (offset < 0) return ranges; ranges = findUpperBound(ranges, offset); ranges = findLowerBound(ranges, offset); if (offset < ranges.getOffset() || offset >= ranges.getEnd()) { throwRangesError(ranges, offset, offset); } return ranges; }
/** Finds compressed offset in a stream and makes sure iter points to its position. This may be necessary for obscure combinations of compression and encoding boundaries. */ private static DiskRangeList findExactPosition(DiskRangeList ranges, long offset) { if (offset < 0) return ranges; ranges = findUpperBound(ranges, offset); ranges = findLowerBound(ranges, offset); if (offset < ranges.getOffset() || offset >= ranges.getEnd()) { throwRangesError(ranges, offset, offset); } return ranges; }
private static DiskRangeList findIntersectingPosition( DiskRangeList ranges, long offset, long end) { if (offset < 0) return ranges; ranges = findUpperBound(ranges, offset); ranges = findLowerBound(ranges, end); // We are now on some intersecting buffer, find the first intersecting buffer. while (ranges.prev != null && ranges.prev.getEnd() > offset) { if (ranges.prev.getEnd() > ranges.getOffset()) { throwRangesError(ranges, offset, end); } ranges = ranges.prev; } return ranges; }
private static DiskRangeList findIntersectingPosition( DiskRangeList ranges, long offset, long end) { if (offset < 0) return ranges; ranges = findUpperBound(ranges, offset); ranges = findLowerBound(ranges, end); // We are now on some intersecting buffer, find the first intersecting buffer. while (ranges.prev != null && ranges.prev.getEnd() > offset) { if (ranges.prev.getEnd() > ranges.getOffset()) { throwRangesError(ranges, offset, end); } ranges = ranges.prev; } return ranges; }