package io.netty.channel;

import io.netty.buffer.ChannelBuffer;

import java.util.Queue;

public final class ChannelBufferHolder<E> {

    private final Queue<E> msgBuf;
    private final ChannelBuffer byteBuf;

    ChannelBufferHolder(Queue<E> msgBuf) {
        if (msgBuf == null) {
            throw new NullPointerException("msgBuf");
        }
        this.msgBuf = msgBuf;
        byteBuf = null;

    }

    ChannelBufferHolder(ChannelBuffer byteBuf) {
        if (byteBuf == null) {
            throw new NullPointerException("byteBuf");
        }
        msgBuf = null;
        this.byteBuf = byteBuf;
    }

    public boolean hasMessageBuffer() {
        return msgBuf != null;
    }

    public boolean hasByteBuffer() {
        return byteBuf != null;
    }

    public Queue<E> messageBuffer() {
        if (!hasMessageBuffer()) {
            throw new IllegalStateException("does not have a message buffer");
        }
        return msgBuf;
    }

    public ChannelBuffer byteBuffer() {
        if (!hasByteBuffer()) {
            throw new IllegalStateException("does not have a byte buffer");
        }
        return byteBuf;
    }
}

@@ -1145,11 +1145,215 @@
 f;%0A    %7D
+%0A%0A    @Override%0A    public String toString() %7B%0A        if (hasMessageBuffer()) %7B%0A            return messageBuffer().toString();%0A        %7D else %7B%0A            return byteBuffer().toString();%0A        %7D%0A    %7D
 %0A%7D%0A

Add ChannelBufferHolder.toString()