Package io.netty.buffer

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


            ByteBuf frame = createContinuationFrame(ctx, streamId, headerBlock, padding);
            out.addComponent(frame);
            numBytes += frame.readableBytes();
        }

        out.writerIndex(numBytes);
        return ctx.write(out, promise);
    }

    /**
     * Allocates a new buffer and writes a single continuation frame with a fragment of the header
View Full Code Here


        ChannelOutboundBuffer buffer = new ChannelOutboundBuffer(channel);

        CompositeByteBuf comp = compositeBuffer(256);
        ByteBuf buf = directBuffer().writeBytes("buf1".getBytes(CharsetUtil.US_ASCII));
        for (int i = 0; i < 65; i++) {
            comp.addComponent(buf.copy()).writerIndex(comp.writerIndex() + buf.readableBytes());
        }
        buffer.addMessage(comp, comp.readableBytes(), channel.voidPromise());

        assertEquals("Should still be 0 as not flushed yet", 0, buffer.nioBufferCount());
        buffer.addFlush();
View Full Code Here

    public void testSimpleSendCompositeDirectByteBuf(Bootstrap sb, Bootstrap cb) throws Throwable {
        CompositeByteBuf buf = Unpooled.compositeBuffer();
        buf.addComponent(Unpooled.directBuffer().writeBytes(BYTES, 0, 2));
        buf.addComponent(Unpooled.directBuffer().writeBytes(BYTES, 2, 2));
        buf.writerIndex(4);
        testSimpleSend0(sb, cb, buf, true, BYTES, 1);

        CompositeByteBuf buf2 = Unpooled.compositeBuffer();
        buf2.addComponent(Unpooled.directBuffer().writeBytes(BYTES, 0, 2));
        buf2.addComponent(Unpooled.directBuffer().writeBytes(BYTES, 2, 2));
View Full Code Here

        testSimpleSend0(sb, cb, buf, true, BYTES, 1);

        CompositeByteBuf buf2 = Unpooled.compositeBuffer();
        buf2.addComponent(Unpooled.directBuffer().writeBytes(BYTES, 0, 2));
        buf2.addComponent(Unpooled.directBuffer().writeBytes(BYTES, 2, 2));
        buf2.writerIndex(4);
        testSimpleSend0(sb, cb, buf2, true, BYTES, 4);
    }

    @Test
    public void testSimpleSendCompositeHeapByteBuf() throws Throwable {
View Full Code Here

    public void testSimpleSendCompositeHeapByteBuf(Bootstrap sb, Bootstrap cb) throws Throwable {
        CompositeByteBuf buf = Unpooled.compositeBuffer();
        buf.addComponent(Unpooled.buffer().writeBytes(BYTES, 0, 2));
        buf.addComponent(Unpooled.buffer().writeBytes(BYTES, 2, 2));
        buf.writerIndex(4);
        testSimpleSend0(sb, cb, buf, true, BYTES, 1);

        CompositeByteBuf buf2 = Unpooled.compositeBuffer();
        buf2.addComponent(Unpooled.buffer().writeBytes(BYTES, 0, 2));
        buf2.addComponent(Unpooled.buffer().writeBytes(BYTES, 2, 2));
View Full Code Here

        testSimpleSend0(sb, cb, buf, true, BYTES, 1);

        CompositeByteBuf buf2 = Unpooled.compositeBuffer();
        buf2.addComponent(Unpooled.buffer().writeBytes(BYTES, 0, 2));
        buf2.addComponent(Unpooled.buffer().writeBytes(BYTES, 2, 2));
        buf2.writerIndex(4);
        testSimpleSend0(sb, cb, buf2, true, BYTES, 4);
    }

    @Test
    public void testSimpleSendCompositeMixedByteBuf() throws Throwable {
View Full Code Here

    public void testSimpleSendCompositeMixedByteBuf(Bootstrap sb, Bootstrap cb) throws Throwable {
        CompositeByteBuf buf = Unpooled.compositeBuffer();
        buf.addComponent(Unpooled.directBuffer().writeBytes(BYTES, 0, 2));
        buf.addComponent(Unpooled.buffer().writeBytes(BYTES, 2, 2));
        buf.writerIndex(4);
        testSimpleSend0(sb, cb, buf, true, BYTES, 1);

        CompositeByteBuf buf2 = Unpooled.compositeBuffer();
        buf2.addComponent(Unpooled.directBuffer().writeBytes(BYTES, 0, 2));
        buf2.addComponent(Unpooled.buffer().writeBytes(BYTES, 2, 2));
View Full Code Here

        testSimpleSend0(sb, cb, buf, true, BYTES, 1);

        CompositeByteBuf buf2 = Unpooled.compositeBuffer();
        buf2.addComponent(Unpooled.directBuffer().writeBytes(BYTES, 0, 2));
        buf2.addComponent(Unpooled.buffer().writeBytes(BYTES, 2, 2));
        buf2.writerIndex(4);
        testSimpleSend0(sb, cb, buf2, true, BYTES, 4);
    }

    @Test
    public void testSimpleSendWithoutBind() throws Throwable {
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.