code: public void removeBytes(long writtenBytes) {
          for (;;) {
              Object msg = current();
              if (!(msg instanceof ByteBuf)) {
                  assert writtenBytes == 0;
                  break;
              }
  
              final ByteBuf buf = (ByteBuf) msg;
              final int readerIndex = buf.readerIndex();
              final int readableBytes = buf.writerIndex() - readerIndex;
  
              if (readableBytes <= writtenBytes) {
                  if (writtenBytes != 0) {
                      progress(readableBytes);
                      writtenBytes -= readableBytes;
                  }
                  remove();
              } else { // readableBytes > writtenBytes
                  if (writtenBytes != 0) {
                      buf.readerIndex(readerIndex + (int) writtenBytes);
                      progress(writtenBytes);
                  }
                  break;
              }
          }
          clearNioBuffers();
      }
docs: Removes the fully written entries and update the reader index of the partially written entry.
  This operation assumes all messages in this buffer is {@link ByteBuf}.