@Test public void testWriteRawVarint32() { ByteBuf buf = Unpooled.buffer(); ByteBufUtils.writeRawVarint32(buf, 1); ByteBufUtils.writeRawVarint32(buf, 2); ByteBufUtils.writeRawVarint32(buf, 111); ByteBufUtils.writeRawVarint32(buf, 1234); ByteBufUtils.writeRawVarint32(buf, 0); ByteBufUtils.writeRawVarint32(buf, Integer.MAX_VALUE); ByteBufUtils.writeRawVarint32(buf, Integer.MIN_VALUE); assertTrue(ByteBufUtils.readRawVarint32(buf) == 1); assertTrue(ByteBufUtils.readRawVarint32(buf) == 2); assertTrue(ByteBufUtils.readRawVarint32(buf) == 111); assertTrue(ByteBufUtils.readRawVarint32(buf) == 1234); assertTrue(ByteBufUtils.readRawVarint32(buf) == 0); assertTrue(ByteBufUtils.readRawVarint32(buf) == Integer.MAX_VALUE); assertTrue(ByteBufUtils.readRawVarint32(buf) == Integer.MIN_VALUE); }
public static void writeRawVarint32(ByteBuf out, int value) { while (true) { if ((value & ~0x7F) == 0) { out.writeByte(value); return; } else { out.writeByte((value & 0x7F) | 0x80); value >>>= 7; } } }
ByteBufUtils { public static void writeRawVarint32(ByteBuf out, int value) { while (true) { if ((value & ~0x7F) == 0) { out.writeByte(value); return; } else { out.writeByte((value & 0x7F) | 0x80); value >>>= 7; } } } }
ByteBufUtils { public static void writeRawVarint32(ByteBuf out, int value) { while (true) { if ((value & ~0x7F) == 0) { out.writeByte(value); return; } else { out.writeByte((value & 0x7F) | 0x80); value >>>= 7; } } }  }
ByteBufUtils { public static void writeRawVarint32(ByteBuf out, int value) { while (true) { if ((value & ~0x7F) == 0) { out.writeByte(value); return; } else { out.writeByte((value & 0x7F) | 0x80); value >>>= 7; } } }  static void writeRawVarint32(ByteBuf out, int value); static int readRawVarint32(ByteBuf in); static String readString(ByteBuf in, int length); static byte[] readBytes(ByteBuf in); }
ByteBufUtils { public static void writeRawVarint32(ByteBuf out, int value) { while (true) { if ((value & ~0x7F) == 0) { out.writeByte(value); return; } else { out.writeByte((value & 0x7F) | 0x80); value >>>= 7; } } }  static void writeRawVarint32(ByteBuf out, int value); static int readRawVarint32(ByteBuf in); static String readString(ByteBuf in, int length); static byte[] readBytes(ByteBuf in);  }