class QueueBasedFeedableBodyGenerator<T extends Queue<BodyChunk>> implements FeedableBodyGenerator {

    protected final T queue;
    private FeedListener listener;

    protected QueueBasedFeedableBodyGenerator(T queue) {
        this.queue = queue;
    }

    @Override
    public Body createBody() {
        return new PushBody(queue);
    }

    protected abstract boolean offer(BodyChunk chunk) throws Exception;

    @Override
    public boolean feed(final ByteBuf buffer, final boolean isLast) throws Exception {<FILL_FUNCTION_BODY>}

    @Override
    public void setListener(FeedListener listener) {
        this.listener = listener;
    }
}

        boolean offered = offer(new BodyChunk(buffer, isLast));
        if (offered && listener != null) {
            listener.onContentAdded();
        }
        return offered;
    
<no_super_class>