public static void putVarInt ( int v , ByteBuffer sink ) { while ( true ) { int bits = v & 0x7f ; v >>>= 7 ; if ( v == 0 ) { sink . put ( ( byte ) bits ) ; return ; } sink . put ( ( byte ) ( bits | 0x80 ) ) ; } }
Encodes an integer in a variable - length encoding 7 bits per byte to a ByteBuffer sink .