protected void initializeDataChunks() {
      if (options.getChunkIdsOnly
          || options.getBlobOptions.getOperationType() == GetBlobOptions.OperationType.BlobInfo) {
        chunkIdIterator = null;
        numChunksTotal = 0;
        dataChunks = null;
      } else {
        chunkIdIterator = chunkMetadataList.listIterator();
        numChunksTotal = chunkMetadataList.size();
        dataChunks = new GetChunk[Math.min(chunkMetadataList.size(), routerConfig.routerMaxInMemGetChunks)];
        for (int i = 0; i < dataChunks.length; i++) {
          int idx = chunkIdIterator.nextIndex();
          CompositeBlobInfo.ChunkMetadata keyAndOffset = chunkIdIterator.next();
          dataChunks[i] = new GetChunk(idx, keyAndOffset);
        }
      }
    }
Initialize data chunks and few other cast for metadata chunk
ambry-router/src/main/java/com/github/ambry/router/GetBlobOperation.java