public ByteBuffer getNextChunk() throws InterruptedException {
    ByteBuf chunkBuf = getNextByteBuf();
    if (chunkBuf == null) {
      return null;
    }
    return convertToByteBuffer(chunkBuf);
  }
Gets the next chunk of data as a {@link ByteBuffer} when it is available.
<p/>
If the channel is not closed, this function blocks until the next chunk is available. Once the channel is closed,
this function starts returning {@code null}.
@return a {@link ByteBuffer} representing the next chunk of data if the channel is not closed. {@code null} if the
        channel is closed.
@throws InterruptedException if the wait for a chunk is interrupted.
ambry-commons/src/main/java/com/github/ambry/commons/ByteBufferAsyncWritableChannel.java