public int writeVInt ( int i ) throws IOException { int count = 0 ; while ( ( i & ~ 0x7F ) != 0 ) { writeByte ( ( byte ) ( ( i & 0x7f ) | 0x80 ) ) ; i >>>= 7 ; count ++ ; } writeByte ( ( byte ) i ) ; return count + 1 ; }
Writes an int in a variable - length format . Writes between one and five bytes . Smaller values take fewer bytes . Negative numbers are not supported .