private void maybeWriteToChannel() {
      // if there are chunks available to be written out, do now.
      if (firstChunk.isComplete() && readCalled) {
        while (operationException.get() == null && chunkIndexToBuf.containsKey(indexOfNextChunkToWriteOut)) {
          ByteBuf byteBuf = chunkIndexToBuf.remove(indexOfNextChunkToWriteOut);
          if (byteBuf != null) {
            chunkIndexToBufWaitingForRelease.put(indexOfNextChunkToWriteOut, byteBuf);
            asyncWritableChannel.write(byteBuf, chunkAsyncWriteCallback);
            indexOfNextChunkToWriteOut++;
          }
        }
        if (operationException.get() != null || numChunksWrittenOut.get() == numChunksTotal) {
          completeRead();
        }
      }
    }
Attempt to write the data associated with the blob to the channel passed in by the caller (if the caller has
done so).
ambry-router/src/main/java/com/github/ambry/router/GetBlobOperation.java