/**
  * 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
  * @
  */
 private void discoverOriginalKeyBounds(Reader reader, int bucket,
                                        Reader.Options options
                                        )
 {
     long rowLength = 0;
     long rowOffset = 0;
     long offset = options.getOffset();
     long maxOffset = options.getMaxOffset();
     bool isTail = true;
     foreach (StripeInformation stripe in 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);
     }
 }
 /**
  * Find the key range for bucket files.
  * @param reader the reader
  * @param options the options for reading with
  * @
  */
 private void discoverKeyBounds(Reader reader,
                                Reader.Options options)
 {
     RecordIdentifier[] keyIndex = OrcRecordUpdater.parseKeyIndex(reader);
     long offset = options.getOffset();
     long maxOffset = options.getMaxOffset();
     int firstStripe = 0;
     int stripeCount = 0;
     bool isTail = true;
     List<StripeInformation> stripes = reader.getStripes();
     foreach (StripeInformation stripe in stripes)
     {
         if (offset > stripe.getOffset())
         {
             firstStripe += 1;
         }
         else if (maxOffset > stripe.getOffset())
         {
             stripeCount += 1;
         }
         else
         {
             isTail = false;
             break;
         }
     }
     if (firstStripe != 0)
     {
         minKey = keyIndex[firstStripe - 1];
     }
     if (!isTail)
     {
         maxKey = keyIndex[firstStripe + stripeCount - 1];
     }
 }