code: private SegmentRange getSegmentRange(final Segment segment, final StreamCut startStreamCut,
                                           final StreamCut endStreamCut) {
          SegmentRangeImpl.SegmentRangeImplBuilder segmentRangeBuilder = SegmentRangeImpl.builder()
                                                                                         .segment(segment);
          if (startStreamCut.asImpl().getPositions().containsKey(segment) && endStreamCut.asImpl().getPositions().containsKey(segment)) {
              //use the meta data present in startStreamCut and endStreamCuts.
              segmentRangeBuilder.startOffset(startStreamCut.asImpl().getPositions().get(segment))
                                 .endOffset(endStreamCut.asImpl().getPositions().get(segment));
          } else {
              //use segment meta data client to fetch the segment offsets.
              SegmentInfo r = segmentToInfo(segment);
              segmentRangeBuilder.startOffset(startStreamCut.asImpl().getPositions().getOrDefault(segment, r.getStartingOffset()))
                                 .endOffset(endStreamCut.asImpl().getPositions().getOrDefault(segment, r.getWriteOffset()));
          }
          return segmentRangeBuilder.build();
      }
docs: /*
  Given a segment, fetch its SegmentRange.
  - If segment is part of startStreamCut / endStreamCut update startOffset and endOffset accordingly.
  - If segment is not part of the streamCuts fetch the data using SegmentMetadataClient.