@Test(expectedExceptions = IllegalArgumentException.class) public void testPackIntNeg() throws IOException { DataInputOutput dio = new DataInputOutput(); LongPacker.packInt(dio.reset(), -42); }
static public int packInt(DataOutput os, int value) throws IOException { if (value < 0) { throw new IllegalArgumentException("negative value: v=" + value); } int i = 1; while ((value & ~0x7F) != 0) { os.write(((value & 0x7F) | 0x80)); value >>>= 7; i++; } os.write((byte) value); return i; }
LongPacker { static public int packInt(DataOutput os, int value) throws IOException { if (value < 0) { throw new IllegalArgumentException("negative value: v=" + value); } int i = 1; while ((value & ~0x7F) != 0) { os.write(((value & 0x7F) | 0x80)); value >>>= 7; i++; } os.write((byte) value); return i; } }
LongPacker { static public int packInt(DataOutput os, int value) throws IOException { if (value < 0) { throw new IllegalArgumentException("negative value: v=" + value); } int i = 1; while ((value & ~0x7F) != 0) { os.write(((value & 0x7F) | 0x80)); value >>>= 7; i++; } os.write((byte) value); return i; } private  LongPacker(); }
LongPacker { static public int packInt(DataOutput os, int value) throws IOException { if (value < 0) { throw new IllegalArgumentException("negative value: v=" + value); } int i = 1; while ((value & ~0x7F) != 0) { os.write(((value & 0x7F) | 0x80)); value >>>= 7; i++; } os.write((byte) value); return i; } private  LongPacker(); static int packLong(DataOutput os, long value); static int packLong(byte[] ba, long value); static long unpackLong(DataInput is); static long unpackLong(byte[] ba); static long unpackLong(byte[] ba, int index); static int packInt(DataOutput os, int value); static int unpackInt(DataInput is); static int unpackInt(ByteBuffer bb); }
LongPacker { static public int packInt(DataOutput os, int value) throws IOException { if (value < 0) { throw new IllegalArgumentException("negative value: v=" + value); } int i = 1; while ((value & ~0x7F) != 0) { os.write(((value & 0x7F) | 0x80)); value >>>= 7; i++; } os.write((byte) value); return i; } private  LongPacker(); static int packLong(DataOutput os, long value); static int packLong(byte[] ba, long value); static long unpackLong(DataInput is); static long unpackLong(byte[] ba); static long unpackLong(byte[] ba, int index); static int packInt(DataOutput os, int value); static int unpackInt(DataInput is); static int unpackInt(ByteBuffer bb);  }