code: public void seekToRecord(long recordNumber) throws IOException {
          if (currentRecordNumber == recordNumber)
              return;
          long skip;
          if (recordNumber < fileIndex.getStartingRecordNumber()) {
              if (currentRecordNumber < recordNumber)
                  skip = recordNumber - currentRecordNumber;
              else {
                  skip = recordNumber;
                  seek0(0);
              }
          } else if (recordNumber > fileIndex.getLastRecordNumber()) {
              if (currentRecordNumber < recordNumber)
                  skip = recordNumber - currentRecordNumber;
              else {
                  long record = fileIndex.getLastRecordNumber();
                  skip = recordNumber - record;
                  seek0(fileIndex.getNearestPosition(record));
              }
          } else if (recordNumber > currentRecordNumber && recordNumber - currentRecordNumber < fileIndex.getStep()) {
              skip = recordNumber - currentRecordNumber;
          } else {
              seek0(fileIndex.getNearestPosition(recordNumber));
              skip = recordNumber - fileIndex.getNearestRecordNumber(recordNumber);
          }
  
          for (; skip > 0; --skip)
              skip();
  
          currentRecordNumber = recordNumber;
      }
docs: Sets the file-pointer offset, measured from the beginning of this file, at which the next record occurs.
  
  @param recordNumber number of record, at which to set the file pointer.
  @throws IOException if {@code pos} is less than {@code 0} or if an I/O error occurs.