public long readVarLong ( boolean optimizePositive ) throws KryoException { if ( require ( 1 ) < 9 ) return readVarLong_slow ( optimizePositive ) ; int p = position ; int b = buffer [ p ++ ] ; long result = b & 0x7F ; if ( ( b & 0x80 ) != 0 ) { byte [ ] buffer = this . buffer ; b = buffer [ p ++ ] ; result |= ( b & 0x7F ) << 7 ; if ( ( b & 0x80 ) != 0 ) { b = buffer [ p ++ ] ; result |= ( b & 0x7F ) << 14 ; if ( ( b & 0x80 ) != 0 ) { b = buffer [ p ++ ] ; result |= ( b & 0x7F ) << 21 ; if ( ( b & 0x80 ) != 0 ) { b = buffer [ p ++ ] ; result |= ( long ) ( b & 0x7F ) << 28 ; if ( ( b & 0x80 ) != 0 ) { b = buffer [ p ++ ] ; result |= ( long ) ( b & 0x7F ) << 35 ; if ( ( b & 0x80 ) != 0 ) { b = buffer [ p ++ ] ; result |= ( long ) ( b & 0x7F ) << 42 ; if ( ( b & 0x80 ) != 0 ) { b = buffer [ p ++ ] ; result |= ( long ) ( b & 0x7F ) << 49 ; if ( ( b & 0x80 ) != 0 ) { b = buffer [ p ++ ] ; result |= ( long ) b << 56 ; } } } } } } } } position = p ; return optimizePositive ? result : ( ( result >>> 1 ) ^ - ( result & 1 ) ) ; }
Reads a 1 - 9 byte long .