Package io.netty.buffer

Examples of io.netty.buffer.ByteBuf.clear()


        buf.clear();
        ByteBufUtils.writeVarInt(buf, 16383, 2);
        assertEquals("16383 is 16383", 16383, ByteBufUtils.readVarInt(buf, 2));

        buf.clear();
        ByteBufUtils.writeVarInt(buf, 16384, 3);
        assertEquals("16384 is 16384", 16384, ByteBufUtils.readVarInt(buf, 3));

        buf.clear();
        ByteBufUtils.writeVarInt(buf, 2097151, 3);
View Full Code Here


        buf.clear();
        ByteBufUtils.writeVarInt(buf, 16384, 3);
        assertEquals("16384 is 16384", 16384, ByteBufUtils.readVarInt(buf, 3));

        buf.clear();
        ByteBufUtils.writeVarInt(buf, 2097151, 3);
        assertEquals("2097151 is 2097151", 2097151, ByteBufUtils.readVarInt(buf, 3));

        buf.clear();
        ByteBufUtils.writeVarInt(buf, 2097152, 4);
View Full Code Here

        buf.clear();
        ByteBufUtils.writeVarInt(buf, 2097151, 3);
        assertEquals("2097151 is 2097151", 2097151, ByteBufUtils.readVarInt(buf, 3));

        buf.clear();
        ByteBufUtils.writeVarInt(buf, 2097152, 4);
        assertEquals("2097152 is 2097152", 2097152, ByteBufUtils.readVarInt(buf, 4));

        buf.clear();
        ByteBufUtils.writeVarInt(buf, 268435455, 4);
View Full Code Here

        buf.clear();
        ByteBufUtils.writeVarInt(buf, 2097152, 4);
        assertEquals("2097152 is 2097152", 2097152, ByteBufUtils.readVarInt(buf, 4));

        buf.clear();
        ByteBufUtils.writeVarInt(buf, 268435455, 4);
        assertEquals("268435455 is 268435455", 268435455, ByteBufUtils.readVarInt(buf, 4));

        buf.clear();
        ByteBufUtils.writeVarInt(buf, 268435456, 5);
View Full Code Here

        buf.clear();
        ByteBufUtils.writeVarInt(buf, 268435455, 4);
        assertEquals("268435455 is 268435455", 268435455, ByteBufUtils.readVarInt(buf, 4));

        buf.clear();
        ByteBufUtils.writeVarInt(buf, 268435456, 5);
        assertEquals("268435456 is 268435456", 268435456, ByteBufUtils.readVarInt(buf, 5));
    }

    @Test
View Full Code Here

        ByteBuf buf = Unpooled.buffer(3,3);
        ByteBufUtils.writeVarShort(buf, 32766);
        assertArrayEquals("Two byte short written", new byte[] { 127, -2, 0}, buf.array());
        assertEquals("Two byte short written", 2, buf.readableBytes());

        buf.clear();
        buf.writeZero(3);
        buf.clear();

        buf.writeShort(32766);
        assertArrayEquals("Two byte short written", new byte[] { 127, -2, 0}, buf.array());
View Full Code Here

        assertArrayEquals("Two byte short written", new byte[] { 127, -2, 0}, buf.array());
        assertEquals("Two byte short written", 2, buf.readableBytes());

        buf.clear();
        buf.writeZero(3);
        buf.clear();

        buf.writeShort(32766);
        assertArrayEquals("Two byte short written", new byte[] { 127, -2, 0}, buf.array());
        int val = ByteBufUtils.readVarShort(buf);
View Full Code Here

        assertArrayEquals("Two byte short written", new byte[] { 127, -2, 0}, buf.array());
        int val = ByteBufUtils.readVarShort(buf);

        assertEquals("Two byte short read correctly", 32766, val);

        buf.clear();
        buf.writeZero(3);
        buf.clear();

        ByteBufUtils.writeVarShort(buf, 32768);
        assertArrayEquals("Three byte short written", new byte[] { -128, 0, 1}, buf.array());
View Full Code Here

        assertEquals("Two byte short read correctly", 32766, val);

        buf.clear();
        buf.writeZero(3);
        buf.clear();

        ByteBufUtils.writeVarShort(buf, 32768);
        assertArrayEquals("Three byte short written", new byte[] { -128, 0, 1}, buf.array());
        assertEquals("Three byte short written", 3, buf.readableBytes());
View Full Code Here

        ByteBufUtils.writeVarShort(buf, 32768);
        assertArrayEquals("Three byte short written", new byte[] { -128, 0, 1}, buf.array());
        assertEquals("Three byte short written", 3, buf.readableBytes());

        buf.clear();
        buf.writeZero(3);
        buf.clear();
        buf.writeShort(-32768);
        buf.writeByte(1);
        val = ByteBufUtils.readVarShort(buf);
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.