public int readFromCells(Codec.Decoder cellDecoder, int expectedCount) throws IOException {
    cells.clear();
    cells.ensureCapacity(expectedCount);
    while (cells.size() < expectedCount && cellDecoder.advance()) {
      add(cellDecoder.current());
    }
    return cells.size();
  }
Reads WALEdit from cells.
@param cellDecoder   Cell decoder.
@param expectedCount Expected cell count.
@return Number of KVs read.
hbase-server/src/main/java/org/apache/hadoop/hbase/wal/WALEdit.java