private static void cacheBlocks(Configuration conf, CacheConfig cacheConfig, FileSystem fs,
    Path path, HFileContext cxt) throws IOException {
    FSDataInputStreamWrapper fsdis = new FSDataInputStreamWrapper(fs, path);
    long fileSize = fs.getFileStatus(path).getLen();
    FixedFileTrailer trailer = FixedFileTrailer.readFromStream(fsdis.getStream(false), fileSize);
    ReaderContext context = new ReaderContextBuilder().withFilePath(path).withFileSize(fileSize)
      .withFileSystem(fsdis.getHfs()).withInputStreamWrapper(fsdis).build();
    HFileInfo fileInfo = new HFileInfo(context, conf);
    HFile.Reader reader = new HFilePreadReader(context, fileInfo, cacheConfig, conf);
    fileInfo.initMetaAndIndex(reader);
    long offset = trailer.getFirstDataBlockOffset(), max = trailer.getLastDataBlockOffset();
    List<HFileBlock> blocks = new ArrayList<>(4);
    HFileBlock block;
    while (offset <= max) {
      block = reader.readBlock(offset, -1, /* cacheBlock */ true, /* pread */ false,
        /* isCompaction */ false, /* updateCacheMetrics */ true, null, null);
      offset += block.getOnDiskSizeWithHeader();
      blocks.add(block);
    }
    LOG.info("read " + Iterables.toString(blocks));
    reader.close();
  }
Read all blocks from {@code path} to populate {@code blockCache}.
hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/TestLazyDataBlockDecompression.java