func readVarNumber(maxBytes uint16, r io.Reader) ([]byte, error) {
	buf := make([]byte, 1)
	var bits []byte
	for {
		if n, err := r.Read(buf); err != nil || n != 1 {
			return nil, errors.Errorf("read %d bytes (wanted one) of number with err: %v", n, err)
		}
		bits = append(bits, buf[0])
		if (buf[0] & 0x80) != 0 {
			break
		}
		if uint16(len(bits)) >= maxBytes {
			return nil, errors.Errorf("number not terminated after %d bytes", maxBytes)
		}
	}

	return bits, nil
}
// readVarNumber reads until the high bit is set, which signals the end of the
// variable-length number, or maxBytes is hit.  If maxBytes is reached without
// the number being terminated, then an error is returned.  The bits are not modified.
readVarNumber reads until the high bit is set, which signals the end of the
variable-length number, or maxBytes is hit.  If maxBytes is reached without
the number being terminated, then an error is returned.  The bits are not modified.
// readVarNumber reads until the high bit is set which signals the end of the // variable - length number or maxBytes is hit . If maxBytes is reached without // the number being terminated then an error is returned . The bits are not modified .
func readVarNumber(maxBytes uint16, r io.Reader) ([]byte, error) {
	buf := make([]byte, 1)
	var bits []byte
	for {
		if n, err := r.Read(buf); err != nil || n != 1 {
			return nil, errors.Errorf("read %d bytes (wanted one) of number with err: %v", n, err)
		}
		bits = append(bits, buf[0])
		if (buf[0] & 0x80) != 0 {
			break
		}
		if uint16(len(bits)) >= maxBytes {
			return nil, errors.Errorf("number not terminated after %d bytes", maxBytes)
		}
	}
	return bits, nil
}
func readVarNumber ( maxBytes uint16 , r io . Reader ) ( [ ] byte , error ) { buf := make ( [ ] byte , 1 ) var bits [ ] byte for { if n , err := r . Read ( buf ) ; err != nil || n != 1 { return nil , errors . Errorf ( " " , n , err ) } bits = append ( bits , buf [ 0 ] ) if ( buf [ 0 ] & 0x80 ) != 0 { break } if uint16 ( len ( bits ) ) >= maxBytes { return nil , errors . Errorf ( " " , maxBytes ) } } return bits , nil }
readVarNumber reads until the high bit is set, which signals the end of the
variable-length number, or maxBytes is hit.
readVarNumber reads until the high bit is set which signals the end of the variable - length number or maxBytes is hit .