Package io.netty.buffer

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


        for (String byteString : bytes) {
            buffer.writeByte(Byte.parseByte(byteString));
        }

        // the header isn't parsed by using reflection
        buffer.readByte();
        buffer.readByte();
       
        // deserializer the object
        P008_TestPacket testIncomingPacket = (P008_TestPacket) packetDeserializer.deserialize(buffer);
View Full Code Here


            buffer.writeByte(Byte.parseByte(byteString));
        }

        // the header isn't parsed by using reflection
        buffer.readByte();
        buffer.readByte();
       
        // deserializer the object
        P008_TestPacket testIncomingPacket = (P008_TestPacket) packetDeserializer.deserialize(buffer);

        // test that the deserializer correctly extracted all values
View Full Code Here

        // compare the size of each bufffer
        assertEquals(neededOutputBytes.writerIndex(), generatedOutputBytes.writerIndex());
       
        int writerIndex = generatedOutputBytes.writerIndex();
        for(int i = 1 ; i < writerIndex; i++) {
            assertEquals(generatedOutputBytes.readByte(), neededOutputBytes.readByte());
        }
    }
}
View Full Code Here

        if (buf.readableBytes() < 7) {
            return;
        }

        int magic = buf.readUnsignedShort();
        byte type = buf.readByte();
        int sessionId = buf.readInt();

        if (magic != 0xFEFD) {
            return;
        }
View Full Code Here

        channel.writeOutbound(request);

        ByteBuf encoded = (ByteBuf) channel.readOutbound();

        Assert.assertNotNull(encoded);
        Assert.assertEquals(request.magic(), encoded.readByte());
        Assert.assertEquals(request.opCode(), encoded.readByte());
        Assert.assertEquals(4, encoded.readShort());
        Assert.assertEquals((byte) 0x08, encoded.readByte());
        Assert.assertEquals((byte) 0, encoded.readByte());
        Assert.assertEquals(0, encoded.readShort());
View Full Code Here

        ByteBuf encoded = (ByteBuf) channel.readOutbound();

        Assert.assertNotNull(encoded);
        Assert.assertEquals(request.magic(), encoded.readByte());
        Assert.assertEquals(request.opCode(), encoded.readByte());
        Assert.assertEquals(4, encoded.readShort());
        Assert.assertEquals((byte) 0x08, encoded.readByte());
        Assert.assertEquals((byte) 0, encoded.readByte());
        Assert.assertEquals(0, encoded.readShort());
        Assert.assertEquals(4 + 6 + 8, encoded.readInt());
View Full Code Here

        Assert.assertNotNull(encoded);
        Assert.assertEquals(request.magic(), encoded.readByte());
        Assert.assertEquals(request.opCode(), encoded.readByte());
        Assert.assertEquals(4, encoded.readShort());
        Assert.assertEquals((byte) 0x08, encoded.readByte());
        Assert.assertEquals((byte) 0, encoded.readByte());
        Assert.assertEquals(0, encoded.readShort());
        Assert.assertEquals(4 + 6 + 8, encoded.readInt());
        Assert.assertEquals(request.id(), encoded.readInt());
        Assert.assertEquals(request.cas(), encoded.readLong());
View Full Code Here

        Assert.assertNotNull(encoded);
        Assert.assertEquals(request.magic(), encoded.readByte());
        Assert.assertEquals(request.opCode(), encoded.readByte());
        Assert.assertEquals(4, encoded.readShort());
        Assert.assertEquals((byte) 0x08, encoded.readByte());
        Assert.assertEquals((byte) 0, encoded.readByte());
        Assert.assertEquals(0, encoded.readShort());
        Assert.assertEquals(4 + 6 + 8, encoded.readInt());
        Assert.assertEquals(request.id(), encoded.readInt());
        Assert.assertEquals(request.cas(), encoded.readLong());
        Assert.assertEquals(request.flags(), encoded.readInt());
View Full Code Here

      return;
    }

    ByteBuf stream = packet.payload.stream;

    tile.setFilter(stream.readByte(), FluidRegistry.getFluid(stream.readShort()));
  }
}
View Full Code Here

     */
    public static Map<String, String> readModList(PluginMessage pluginMessage)
    {
        Map<String, String> modTags = Maps.newHashMap();
        ByteBuf payload = Unpooled.wrappedBuffer( pluginMessage.getData() );
        byte discriminator = payload.readByte();
        if ( discriminator == 2 ) // ModList
        {
            ByteBuf buffer = payload.slice();
            int modCount = DefinedPacket.readVarInt( buffer, 2 );
            for ( int i = 0; i < modCount; i++ )
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.