Buffered encoder 4.0

Introduce a new abstract codec called MessageToBufferedByteEncoder which allows to buffer written data into one buffer.

Using the sub-class in protocols that allows for pipelining or for cases where the messages are made out of multiple parts can improve performance a lot. To show this HTTP was moved over to use the MessageToBufferedByteEncoder which shows a large performance improvement
Good point. I wonder if we could write some checkstyle rule

> Am 21.07.2014 um 20:54 schrieb Trustin Lee <notifications@github.com>:
> 
> In codec/src/main/java/io/netty/handler/codec/MessageToBufferedByteEncoder.java:
> 
> > +     * @param initialBufferCapacity The size of the buffer when it is allocated.
> > +     */
> > +    protected MessageToBufferedByteEncoder(
> > +            Class<? extends I> outboundMessageType, boolean preferDirect, int initialBufferCapacity) {
> > +        checkSharable();
> > +        checkBufferSize(initialBufferCapacity);
> > +        matcher = TypeParameterMatcher.get(outboundMessageType);
> > +        this.initialBufferCapacity = initialBufferCapacity;
> > +        this.preferDirect = preferDirect;
> > +    }
> > +
> > +    private static void checkBufferSize(int initialBufferCapacity) {
> > +        if (initialBufferCapacity < 0) {
> > +            throw new IllegalArgumentException(
> > +                    "initialBufferCapacity must be a >= 0: " +
> > +                            initialBufferCapacity);
> BTW we should use the same style for the exception messages. In most places, we do this:
> 
> argumentName: <badValue> (expected: condition)
> in this case:
> 
> "initialBufferCapacity: " + initialBufferCapacity + " (expected: >= 0)"
> —
> Reply to this email directly or view it on GitHub.