ByteBuf buf = Unpooled.buffer(4); buf.writeShort(123); short value = buf.readShort(); System.out.println("Value: " + value);
ByteBuf buf = ... // get ByteBuf from network stream if (buf.readableBytes() >= 2) { short value = buf.readShort(); System.out.println("Value: " + value); }
io.netty netty-all 4.1.52.Final