protected static MultiByteInteger readMBI(DataInputStream in) throws IOException {
  byte digit;
  long msgLength=0;
  int multiplier=1;
  int count=0;
  do {
    digit=in.readByte();
    count++;
    msgLength+=((digit & 0x7F) * multiplier);
    multiplier*=128;
  }
 while ((digit & 0x80) != 0);
  return new MultiByteInteger(msgLength,count);
}

protected static MultiByteInteger readMBI ( DataInputStream in ) throws IOException { byte digit ; long msgLength = 0 ; int multiplier = 1 ; int count = 0 ; do { digit = in . readByte ( ) ; count ++ ; msgLength += ( ( digit & 0x7F ) * multiplier ) ; multiplier *= 128 ; } while ( ( digit & 0x80 ) != 0 ) ; return new MultiByteInteger ( msgLength , count ) ; }
decodes an mqtt multi - byte integer from the given stream .
