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