Package io.netty.buffer

Examples of io.netty.buffer.CompositeByteBuf.writerIndex()


            ByteBuf m = channel.readOutbound();
            if (m == null) {
                break;
            }
            actual.addComponent(m);
            actual.writerIndex(actual.writerIndex() + m.readableBytes());
        }
        assertEquals(releaseLater(expected), releaseLater(actual));
        in.release();
    }
View Full Code Here


            ByteBuf m = channel.readOutbound();
            if (m == null) {
                break;
            }
            actual.addComponent(m);
            actual.writerIndex(actual.writerIndex() + m.readableBytes());
        }
        assertEquals(releaseLater(expected), releaseLater(actual));
        in.release();
    }
View Full Code Here

    private static byte[] uncompress(EmbeddedChannel channel) throws Exception {
        CompositeByteBuf out = Unpooled.compositeBuffer();
        ByteBuf msg;
        while ((msg = channel.readOutbound()) != null) {
            out.addComponent(msg);
            out.writerIndex(out.writerIndex() + msg.readableBytes());
        }

        byte[] compressed = new byte[out.readableBytes()];
        out.readBytes(compressed);
        out.release();
View Full Code Here

    private static byte[] uncompress(EmbeddedChannel channel) throws Exception {
        CompositeByteBuf out = Unpooled.compositeBuffer();
        ByteBuf msg;
        while ((msg = channel.readOutbound()) != null) {
            out.addComponent(msg);
            out.writerIndex(out.writerIndex() + msg.readableBytes());
        }

        byte[] compressed = new byte[out.readableBytes()];
        out.readBytes(compressed);
        out.release();
View Full Code Here

            ByteBuf msg;
            final CompositeByteBuf compressed = Unpooled.compositeBuffer();
            while ((msg = encoder.readOutbound()) != null) {
                compressed.addComponent(msg);
                compressed.writerIndex(compressed.writerIndex() + msg.readableBytes());
            }
            assertThat(compressed, is(notNullValue()));

            final byte[] compressedArray = new byte[compressed.readableBytes()];
            compressed.readBytes(compressedArray);
View Full Code Here

            ByteBuf msg;
            final CompositeByteBuf compressed = Unpooled.compositeBuffer();
            while ((msg = encoder.readOutbound()) != null) {
                compressed.addComponent(msg);
                compressed.writerIndex(compressed.writerIndex() + msg.readableBytes());
            }
            assertThat(compressed, is(notNullValue()));

            final byte[] compressedArray = new byte[compressed.readableBytes()];
            compressed.readBytes(compressedArray);
View Full Code Here

            assertFalse(compressed.isReadable());
            final CompositeByteBuf decompressed = Unpooled.compositeBuffer();
            while ((msg = decoder.readInbound()) != null) {
                decompressed.addComponent(msg);
                decompressed.writerIndex(decompressed.writerIndex() + msg.readableBytes());
            }
            assertEquals(original, decompressed);

            compressed.release();
            decompressed.release();
View Full Code Here

            assertFalse(compressed.isReadable());
            final CompositeByteBuf decompressed = Unpooled.compositeBuffer();
            while ((msg = decoder.readInbound()) != null) {
                decompressed.addComponent(msg);
                decompressed.writerIndex(decompressed.writerIndex() + msg.readableBytes());
            }
            assertEquals(original, decompressed);

            compressed.release();
            decompressed.release();
View Full Code Here

    private static byte[] uncompress(EmbeddedChannel channel, int length) throws Exception {
        CompositeByteBuf out = Unpooled.compositeBuffer();
        ByteBuf msg;
        while ((msg = channel.readOutbound()) != null) {
            out.addComponent(msg);
            out.writerIndex(out.writerIndex() + msg.readableBytes());
        }

        InputStream is = new ByteBufInputStream(out);
        LzmaInputStream lzmaIs = new LzmaInputStream(is, new Decoder());
        byte[] uncompressed = new byte[length];
View Full Code Here

    private static byte[] uncompress(EmbeddedChannel channel, int length) throws Exception {
        CompositeByteBuf out = Unpooled.compositeBuffer();
        ByteBuf msg;
        while ((msg = channel.readOutbound()) != null) {
            out.addComponent(msg);
            out.writerIndex(out.writerIndex() + msg.readableBytes());
        }

        InputStream is = new ByteBufInputStream(out);
        LzmaInputStream lzmaIs = new LzmaInputStream(is, new Decoder());
        byte[] uncompressed = new byte[length];
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.