@Nullable
  public DataBuffer readChunk(int index) throws IOException {
    if (index >= mDataBuffers.length) {
      return null;
    }

    if (index >= mBufferCount.get()) {
      try (LockResource ignored = new LockResource(mBufferLocks.writeLock())) {
        while (index >= mBufferCount.get()) {
          DataBuffer buffer = readChunk();
          mDataBuffers[mBufferCount.get()] = buffer;
          mBufferCount.incrementAndGet();
        }
      }
    }

    return mDataBuffers[index];
  }
@Test
  public void testSequentialRead() throws Exception {
    int chunkNum = BLOCK_SIZE / CHUNK_SIZE;
    for (int i = 0; i < chunkNum; i++) {
      DataBuffer buffer = mDataReader.readChunk(i);
      Assert.assertEquals(i + 1, mDataReader.getReadChunkNum());
      Assert.assertTrue(mDataReader.validateBuffer(i, buffer));
    }
  }