public Iterator<ExtendedCell> getIterator(int headerSize) {
    final int rawSize = rawKVs.length;
    byte[] encodedDataWithHeader = getEncodedData();
    int bytesToSkip = headerSize + Bytes.SIZEOF_SHORT;
    ByteArrayInputStream bais = new ByteArrayInputStream(encodedDataWithHeader, bytesToSkip,
      encodedDataWithHeader.length - bytesToSkip);
    final DataInputStream dis = new DataInputStream(bais);

    return new Iterator<ExtendedCell>() {
      private ByteBuffer decompressedData = null;
      private Iterator<Boolean> it = isTagsLenZero.iterator();

      @Override
      public boolean hasNext() {
        if (decompressedData == null) {
          return rawSize > 0;
        }
        return decompressedData.hasRemaining();
      }

      @Override
      public ExtendedCell next() {
        if (decompressedData == null) {
          try {
            decompressedData = dataBlockEncoder.decodeKeyValues(dis,
              dataBlockEncoder.newDataBlockDecodingContext(conf, meta));
          } catch (IOException e) {
            throw new RuntimeException("Problem with data block encoder, "
              + "most likely it requested more bytes than are available.", e);
          }
          decompressedData.rewind();
        }
        int offset = decompressedData.position();
        int klen = decompressedData.getInt();
        int vlen = decompressedData.getInt();
        int tagsLen = 0;
        ByteBufferUtils.skip(decompressedData, klen + vlen);
        // Read the tag length in case when stream contain tags
        if (meta.isIncludesTags()) {
          boolean noTags = true;
          if (it.hasNext()) {
            noTags = it.next();
          }
          // ROW_INDEX_V1 will not put tagsLen back in cell if it is zero, there is no need
          // to read short here.
          if (!(encoding.equals(DataBlockEncoding.ROW_INDEX_V1) && noTags)) {
            tagsLen = ((decompressedData.get() & 0xff) << 8) ^ (decompressedData.get() & 0xff);
            ByteBufferUtils.skip(decompressedData, tagsLen);
          }
        }
        KeyValue kv =
          new KeyValue(decompressedData.array(), decompressedData.arrayOffset() + offset,
            (int) KeyValue.getKeyValueDataStructureSize(klen, vlen, tagsLen));
        if (meta.isIncludesMvcc()) {
          long mvccVersion = ByteBufferUtils.readVLong(decompressedData);
          kv.setSequenceId(mvccVersion);
        }
        return kv;
      }

      @Override
      public void remove() {
        throw new NotImplementedException("remove() is not supported!");
      }

      @Override
      public String toString() {
        return "Iterator of: " + dataBlockEncoder.getClass().getName();
      }

    };
  }
Provides access to compressed value.
@param headerSize header size of the block.
@return Forwards sequential iterator.
hbase-common/src/main/java/org/apache/hadoop/hbase/io/encoding/EncodedDataBlock.java