/**
  * Find the key range for original bucket files.
  *
  * @param reader the reader
  * @param bucket the bucket number we are reading
  * @param options the options for reading with
  * @throws IOException
  */
 private void discoverOriginalKeyBounds(Reader reader, int bucket, Reader.Options options)
     throws IOException {
   long rowLength = 0;
   long rowOffset = 0;
   long offset = options.getOffset();
   long maxOffset = options.getMaxOffset();
   boolean isTail = true;
   for (StripeInformation stripe : reader.getStripes()) {
     if (offset > stripe.getOffset()) {
       rowOffset += stripe.getNumberOfRows();
     } else if (maxOffset > stripe.getOffset()) {
       rowLength += stripe.getNumberOfRows();
     } else {
       isTail = false;
       break;
     }
   }
   if (rowOffset > 0) {
     minKey = new RecordIdentifier(0, bucket, rowOffset - 1);
   }
   if (!isTail) {
     maxKey = new RecordIdentifier(0, bucket, rowOffset + rowLength - 1);
   }
 }