public static void encode(long v,OutputStream stream) throws IOException {
  do {
    long bits=v & 0x7F;
    v>>>=7;
    byte b=(byte)(bits | ((v != 0) ? 0x80 : 0));
    stream.write(b);
  }
 while (v != 0);
}

public static void encode ( long v , OutputStream stream ) throws IOException { do { long bits = v & 0x7F ; v >>>= 7 ; byte b = ( byte ) ( bits | ( ( v != 0 ) ? 0x80 : 0 ) ) ; stream . write ( b ) ; } while ( v != 0 ) ; }
encodes the given value onto the stream .
