private int countCellsFromScanner(ResultScanner scanner) throws Exception {
    Result result = null;
    int numCells = 0;
    while ((result = scanner.next()) != null) {
      numCells += result.rawCells().length;
    }

    scanner.close();
    return numCells;
  }
Exhausts the scanner by calling next repetitively. Once completely exhausted, close scanner and
return total cell count
@param scanner the scanner to exhaust
@return the number of cells counted
@throws Exception if there is a problem retrieving cells from the scanner
hbase-server/src/test/java/org/apache/hadoop/hbase/TestPartialResultsFromClientSide.java