Split a JSON byte stream into JSON objects/arrays. Fixes #2536

Motivation:

See GitHub Issue #2536.

Modifications:

Introduce the class JsonObjectDecoder to split a JSON byte stream
into individual JSON objets/arrays.

Result:

A Netty application can now handle a byte stream where multiple JSON
documents follow eachother as opposed to only a single JSON document
per request.

@trustin @daschl @normanmaurer please review :-)
ByteBufUtil.hexdump(...)

> Am 02.07.2014 um 14:02 schrieb Jakob Buchgraber <notifications@github.com>:
> 
> In codec/src/test/java/io/netty/handler/codec/json/JsonObjectDecoderTest.java:
> 
> > +        assertEquals(object2, res.toString(CharsetUtil.UTF_8));
> > +        res.release();
> > +        res = ch.readInbound();
> > +        assertEquals(object3, res.toString(CharsetUtil.UTF_8));
> > +        res.release();
> > +
> > +        assertFalse(ch.finish());
> > +    }
> > +
> > +    @Test
> > +    public void testNotJson() {
> > +        EmbeddedChannel ch = new EmbeddedChannel(new JsonObjectDecoder(Integer.MAX_VALUE));
> > +
> > +        ch.writeInbound(Unpooled.copiedBuffer("blabla 123", CharsetUtil.UTF_8));
> > +        assertNull(ch.readInbound());
> > +        ch.checkException();
> Does Netty have some utility class to print out hexdumps? I only found some code in the LoggingHandler [1]. I think it's best to move the hexdump functionality into it's own utility class. WDYT?
> 
> [1] https://github.com/netty/netty/blob/master/handler/src/main/java/io/netty/handler/logging/LoggingHandler.java#L406
> 
> —
> Reply to this email directly or view it on GitHub.