static DiskRangeList readDiskRanges(FSDataInputStream file,
      HadoopShims.ZeroCopyReaderShim zcr,
      long base,
      DiskRangeList range,
      boolean doForceDirect, int maxChunkLimit) throws IOException {
    if (range == null)
      return null;
    DiskRangeList prev = range.prev;
    if (prev == null) {
      prev = new DiskRangeList.MutateHelper(range);
    }
    while (range != null) {
      if (range.hasData()) {
        range = range.next;
        continue;
      }
      boolean firstRead = true;
      long len = range.getEnd() - range.getOffset();
      long off = range.getOffset();
      while (len > 0) {
        // Stripe could be too large to read fully into a single buffer and
        // will need to be chunked
        int readSize = (len >= maxChunkLimit) ? maxChunkLimit : (int) len;
        ByteBuffer partial;

        // create chunk
        if (zcr != null) {
          if (firstRead) {
            file.seek(base + off);
          }

          partial = zcr.readBuffer(readSize, false);
          readSize = partial.remaining();
        } else {
          // Don't use HDFS ByteBuffer API because it has no readFully, and is
          // buggy and pointless.
          byte[] buffer = new byte[readSize];
          file.readFully((base + off), buffer, 0, buffer.length);
          if (doForceDirect) {
            partial = ByteBuffer.allocateDirect(readSize);
            partial.put(buffer);
            partial.position(0);
            partial.limit(readSize);
          } else {
            partial = ByteBuffer.wrap(buffer);
          }
        }
        BufferChunk bc = new BufferChunk(partial, off);
        if (firstRead) {
          range.replaceSelfWith(bc);
        } else {
          range.insertAfter(bc);
        }
        firstRead = false;
        range = bc;
        len -= readSize;
        off += readSize;
      }
      range = range.next;
    }
    return prev.next;
  }
Read the list of ranges from the file.
@param file the file to read
@param base the base of the stripe
@param range the disk ranges within the stripe to read
@return the bytes read for each disk range, which is the same length as
   ranges
@throws IOException
llap-server/src/java/org/apache/hadoop/hive/llap/io/encoded/LlapRecordReaderUtils.java