@Test(expected = IllegalArgumentException.class) public void testEncodeNegativeFails() throws Exception { VLQ.encode(-1, ByteBuffer.allocate(8)); }
public static void encode(int value, ByteBuffer out) { if (value < 0) { throw new IllegalArgumentException("Cannot encode negative values"); } int b; boolean msbFound = false; b = ((value & 0x70000000) >> 28); if (b != 0) { out.put(((byte) (b | 0x80))); msbFound = true; } b = ((value & 0xFE00000) >> 21); if (msbFound || b != 0) { out.put(((byte) (b | 0x80))); msbFound = true; } b = ((value & 0x1FC000) >> 14); if (msbFound || b != 0) { out.put(((byte) (b | 0x80))); msbFound = true; } b = ((value & 0x3F80) >> 7); if (msbFound || b != 0) { out.put(((byte) (b | 0x80))); } b = (value & 0x7F); out.put((byte) (b)); }
VLQ { public static void encode(int value, ByteBuffer out) { if (value < 0) { throw new IllegalArgumentException("Cannot encode negative values"); } int b; boolean msbFound = false; b = ((value & 0x70000000) >> 28); if (b != 0) { out.put(((byte) (b | 0x80))); msbFound = true; } b = ((value & 0xFE00000) >> 21); if (msbFound || b != 0) { out.put(((byte) (b | 0x80))); msbFound = true; } b = ((value & 0x1FC000) >> 14); if (msbFound || b != 0) { out.put(((byte) (b | 0x80))); msbFound = true; } b = ((value & 0x3F80) >> 7); if (msbFound || b != 0) { out.put(((byte) (b | 0x80))); } b = (value & 0x7F); out.put((byte) (b)); } }
VLQ { public static void encode(int value, ByteBuffer out) { if (value < 0) { throw new IllegalArgumentException("Cannot encode negative values"); } int b; boolean msbFound = false; b = ((value & 0x70000000) >> 28); if (b != 0) { out.put(((byte) (b | 0x80))); msbFound = true; } b = ((value & 0xFE00000) >> 21); if (msbFound || b != 0) { out.put(((byte) (b | 0x80))); msbFound = true; } b = ((value & 0x1FC000) >> 14); if (msbFound || b != 0) { out.put(((byte) (b | 0x80))); msbFound = true; } b = ((value & 0x3F80) >> 7); if (msbFound || b != 0) { out.put(((byte) (b | 0x80))); } b = (value & 0x7F); out.put((byte) (b)); }  }
VLQ { public static void encode(int value, ByteBuffer out) { if (value < 0) { throw new IllegalArgumentException("Cannot encode negative values"); } int b; boolean msbFound = false; b = ((value & 0x70000000) >> 28); if (b != 0) { out.put(((byte) (b | 0x80))); msbFound = true; } b = ((value & 0xFE00000) >> 21); if (msbFound || b != 0) { out.put(((byte) (b | 0x80))); msbFound = true; } b = ((value & 0x1FC000) >> 14); if (msbFound || b != 0) { out.put(((byte) (b | 0x80))); msbFound = true; } b = ((value & 0x3F80) >> 7); if (msbFound || b != 0) { out.put(((byte) (b | 0x80))); } b = (value & 0x7F); out.put((byte) (b)); }  static void encode(int value, ByteBuffer out); static int decode(ReadBuffer in); static int encodedSize(int value); }
VLQ { public static void encode(int value, ByteBuffer out) { if (value < 0) { throw new IllegalArgumentException("Cannot encode negative values"); } int b; boolean msbFound = false; b = ((value & 0x70000000) >> 28); if (b != 0) { out.put(((byte) (b | 0x80))); msbFound = true; } b = ((value & 0xFE00000) >> 21); if (msbFound || b != 0) { out.put(((byte) (b | 0x80))); msbFound = true; } b = ((value & 0x1FC000) >> 14); if (msbFound || b != 0) { out.put(((byte) (b | 0x80))); msbFound = true; } b = ((value & 0x3F80) >> 7); if (msbFound || b != 0) { out.put(((byte) (b | 0x80))); } b = (value & 0x7F); out.put((byte) (b)); }  static void encode(int value, ByteBuffer out); static int decode(ReadBuffer in); static int encodedSize(int value);  }