@SuppressWarnings("unchecked")
    private SimpleBlockFetcher() throws IOException {
      int columns = file.readInt();
      for (int i = 0; i < columns; i++) {
        IColumn column = emptyColumnFamily.getColumnSerializer().deserialize(file);
        if (reversed) blockColumns.addFirst(column);
        else blockColumns.addLast(column);

        /* see if we can stop seeking. */
        boolean outOfBounds = false;
        if (!reversed && finishColumn.remaining() > 0)
          outOfBounds = comparator.compare(column.name(), finishColumn) >= 0;
        else if (reversed && startColumn.remaining() > 0)
          outOfBounds = comparator.compare(column.name(), startColumn) >= 0;
        if (outOfBounds) break;
      }
    }
    @SuppressWarnings("unchecked")
    public boolean getNextBlock() throws IOException {
      if (curRangeIndex < 0 || curRangeIndex >= indexes.size()) return false;

      /* seek to the correct offset to the data, and calculate the data size */
      IndexHelper.IndexInfo curColPosition = indexes.get(curRangeIndex);

      /* see if this read is really necessary. */
      if (reversed) {
        if ((finishColumn.remaining() > 0
                && comparator.compare(finishColumn, curColPosition.lastName) > 0)
            || (startColumn.remaining() > 0
                && comparator.compare(startColumn, curColPosition.firstName) < 0)) return false;
      } else {
        if ((startColumn.remaining() > 0
                && comparator.compare(startColumn, curColPosition.lastName) > 0)
            || (finishColumn.remaining() > 0
                && comparator.compare(finishColumn, curColPosition.firstName) < 0)) return false;
      }

      boolean outOfBounds = false;
      file.reset(mark);
      FileUtils.skipBytesFully(file, curColPosition.offset);
      while (file.bytesPastMark(mark) < curColPosition.offset + curColPosition.width
          && !outOfBounds) {
        IColumn column = emptyColumnFamily.getColumnSerializer().deserialize(file);
        if (reversed) blockColumns.addFirst(column);
        else blockColumns.addLast(column);

        /* see if we can stop seeking. */
        if (!reversed && finishColumn.remaining() > 0)
          outOfBounds = comparator.compare(column.name(), finishColumn) >= 0;
        else if (reversed && startColumn.remaining() > 0)
          outOfBounds = comparator.compare(column.name(), startColumn) >= 0;
      }

      if (reversed) curRangeIndex--;
      else curRangeIndex++;
      return true;
    }
 @SuppressWarnings("unchecked")
 private boolean isColumnNeeded(IColumn column) {
   if (startColumn.remaining() == 0 && finishColumn.remaining() == 0) return true;
   else if (startColumn.remaining() == 0 && !reversed)
     return comparator.compare(column.name(), finishColumn) <= 0;
   else if (startColumn.remaining() == 0 && reversed)
     return comparator.compare(column.name(), finishColumn) >= 0;
   else if (finishColumn.remaining() == 0 && !reversed)
     return comparator.compare(column.name(), startColumn) >= 0;
   else if (finishColumn.remaining() == 0 && reversed)
     return comparator.compare(column.name(), startColumn) <= 0;
   else if (!reversed)
     return comparator.compare(column.name(), startColumn) >= 0
         && comparator.compare(column.name(), finishColumn) <= 0;
   else // if reversed
   return comparator.compare(column.name(), startColumn) <= 0
         && comparator.compare(column.name(), finishColumn) >= 0;
 }