class PushBody implements Body {

    private final Queue<BodyChunk> queue;
    private BodyState state = BodyState.CONTINUE;

    public PushBody(Queue<BodyChunk> queue) {
        this.queue = queue;
    }

    @Override
    public long getContentLength() {
        return -1;
    }

    @Override
    public BodyState transferTo(final ByteBuf target) {
        switch (state) {
            case CONTINUE:
                return readNextChunk(target);
            case STOP:
                return BodyState.STOP;
            default:
                throw new IllegalStateException("Illegal process state.");
        }
    }

    private BodyState readNextChunk(ByteBuf target) {<FILL_FUNCTION_BODY>}

    private void readChunk(ByteBuf target, BodyChunk part) {
        target.writeBytes(part.buffer);
        if (!part.buffer.isReadable()) {
            if (part.last) {
                state = BodyState.STOP;
            }
            queue.remove();
        }
    }

    @Override
    public void close() {
    }
}

        BodyState res = BodyState.SUSPEND;
        while (target.isWritable() && state != BodyState.STOP) {
            BodyChunk nextChunk = queue.peek();
            if (nextChunk == null) {
                // Nothing in the queue. suspend stream if nothing was read. (reads == 0)
                return res;
            } else if (!nextChunk.buffer.isReadable() && !nextChunk.last) {
                // skip empty buffers
                queue.remove();
            } else {
                res = BodyState.CONTINUE;
                readChunk(target, nextChunk);
            }
        }
        return res;
    
<no_super_class>