Package io.netty.buffer

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


        buf.clear();
        ByteBufUtils.writeVarInt(buf, 127, 1);
        assertArrayEquals("127 as byte[] is [127]", new byte[] { 127, 0, 0, 0, 0 }, buf.array());

        buf.clear();
        ByteBufUtils.writeVarInt(buf, 128, 2);
        assertArrayEquals("128 as byte[] is [-128, 1]", new byte[] { -128, 1, 0, 0, 0 }, buf.array());

        buf.clear();
        ByteBufUtils.writeVarInt(buf, 16383, 2);
View Full Code Here


        buf.clear();
        ByteBufUtils.writeVarInt(buf, 128, 2);
        assertArrayEquals("128 as byte[] is [-128, 1]", new byte[] { -128, 1, 0, 0, 0 }, buf.array());

        buf.clear();
        ByteBufUtils.writeVarInt(buf, 16383, 2);
        assertArrayEquals("16383 as byte[] is [-1, 127]", new byte[] { -1, 127, 0, 0, 0 }, buf.array());

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

        buf.clear();
        ByteBufUtils.writeVarInt(buf, 16383, 2);
        assertArrayEquals("16383 as byte[] is [-1, 127]", new byte[] { -1, 127, 0, 0, 0 }, buf.array());

        buf.clear();
        ByteBufUtils.writeVarInt(buf, 16384, 3);
        assertArrayEquals("16384 as byte[] is [-1, -128, 1]", new byte[] { -128, -128, 1, 0, 0 }, buf.array());

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

        buf.clear();
        ByteBufUtils.writeVarInt(buf, 16384, 3);
        assertArrayEquals("16384 as byte[] is [-1, -128, 1]", new byte[] { -128, -128, 1, 0, 0 }, buf.array());

        buf.clear();
        ByteBufUtils.writeVarInt(buf, 2097151, 3);
        assertArrayEquals("2097151 as byte[] is [-1, -1, 127]", new byte[] { -1, -1, 127, 0, 0 }, buf.array());

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

        buf.clear();
        ByteBufUtils.writeVarInt(buf, 2097151, 3);
        assertArrayEquals("2097151 as byte[] is [-1, -1, 127]", new byte[] { -1, -1, 127, 0, 0 }, buf.array());

        buf.clear();
        ByteBufUtils.writeVarInt(buf, 2097152, 4);
        assertArrayEquals("16384 as byte[] is [-128, -128, 1]", new byte[] { -128, -128, -128, 1, 0 }, buf.array());

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

        buf.clear();
        ByteBufUtils.writeVarInt(buf, 2097152, 4);
        assertArrayEquals("16384 as byte[] is [-128, -128, 1]", new byte[] { -128, -128, -128, 1, 0 }, buf.array());

        buf.clear();
        ByteBufUtils.writeVarInt(buf, 268435455, 4);
        assertArrayEquals("268435455 as byte[] is [-1, -1, -1, 127]", new byte[] { -1, -1, -1, 127, 0 }, buf.array());

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

        buf.clear();
        ByteBufUtils.writeVarInt(buf, 268435455, 4);
        assertArrayEquals("268435455 as byte[] is [-1, -1, -1, 127]", new byte[] { -1, -1, -1, 127, 0 }, buf.array());

        buf.clear();
        ByteBufUtils.writeVarInt(buf, 268435456, 5);
        assertArrayEquals("268435456 as byte[] is [-1, -128, 1]", new byte[] { -128, -128, -128, -128, 1 }, buf.array());
    }

    @Test
View Full Code Here

    {
        ByteBuf buf = Unpooled.buffer(5, 5);
        ByteBufUtils.writeVarInt(buf, 1, 1);
        assertEquals("1 is 1", 1, ByteBufUtils.readVarInt(buf, 1));

        buf.clear();
        ByteBufUtils.writeVarInt(buf, 127, 1);
        assertEquals("127 is 127", 127, ByteBufUtils.readVarInt(buf, 1));

        buf.clear();
        ByteBufUtils.writeVarInt(buf, 128, 2);
View Full Code Here

        buf.clear();
        ByteBufUtils.writeVarInt(buf, 127, 1);
        assertEquals("127 is 127", 127, ByteBufUtils.readVarInt(buf, 1));

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

        buf.clear();
        ByteBufUtils.writeVarInt(buf, 16383, 2);
View Full Code Here

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

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

        buf.clear();
        ByteBufUtils.writeVarInt(buf, 16384, 3);
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.