Set the scheme/protocol that will be used to build the final URL.
@param scheme The scheme/protocol that will be used to build the final URL.
@return This UrlBuilder so that multiple setters can be chained together.
19620
public UrlBuilder withScheme(String scheme) {
        if (scheme == null || scheme.isEmpty()) {
            this.scheme = null;
        } else {
            with(scheme, UrlTokenizerState.SCHEME);
        }
        return this;
    }
1205376
public static function setForcedScheme($scheme = null)
    {
        if (! is_string($scheme) && ! is_null($scheme)) {
            throw new InvalidArgumentException(sprintf(
                'Invalid scheme provided; must be an string or a null, "%s" received.',
                is_object($scheme) ? get_class($scheme) : gettype($scheme)
            ));
        }
        static::$forcedScheme = $scheme;
    }
797198
def build(
        cls,
        *,
        scheme="",
        user="",
        password=None,
        host="",
        port=None,
        path="",
        query=None,
        query_string="",
        fragment="",
        encoded=False
    ):
        """"""

        if not host and scheme:
            raise ValueError('Can\'t build URL with "scheme" but without "host".')
        if port and not host:
            raise ValueError('Can\'t build URL with "port" but without "host".')
        if query and query_string:
            raise ValueError('Only one of "query" or "query_string" should be passed')
        if path is None or query_string is None or fragment is None:
            raise TypeError('NoneType is illegal for "path", "query_string" and '
                            '"fragment" args, use string values instead.')

        if not user and not password and not host and not port:
            netloc = ""
        else:
            netloc = cls._make_netloc(user, password, host, port, encode=not encoded)
        if not encoded:
            path = cls._PATH_QUOTER(path)
            if netloc:
                path = cls._normalize_path(path)

            cls._validate_authority_uri_abs_path(host=host, path=path)
            query_string = cls._QUERY_QUOTER(query_string)
            fragment = cls._FRAGMENT_QUOTER(fragment)

        url = cls(
            SplitResult(scheme, netloc, path, query_string, fragment), encoded=True
        )

        if query:
            return url.with_query(query)
        else:
            return url
1323616
protected List<String> searchResultToRobotUrlStrings(String resultHost, String scheme) {
		ArrayList<String> list = new ArrayList<String>();
		
		if (resultHost.startsWith("www")) {
			if (resultHost.startsWith("www.")) {
				list.add(hostToRobotUrlString(resultHost, scheme));
				list.add(hostToRobotUrlString(resultHost.substring(4), scheme));
			} else {
				Matcher m = WWWN_PATTERN.matcher(resultHost);
				if(m.find()) {
					String massagedHost = resultHost.substring(m.end());
					list.add(hostToRobotUrlString("www." + massagedHost, scheme));
					list.add(hostToRobotUrlString(massagedHost, scheme));
				}
				list.add(hostToRobotUrlString(resultHost, scheme));
			}
		} else {
			list.add(hostToRobotUrlString(resultHost, scheme));			
			list.add(hostToRobotUrlString("www." + resultHost, scheme));
		}
		
		return list;
	}
929960
public static IAtomContainerSet getAllAtomContainers(IReactionScheme scheme) {
        return getAllAtomContainers(scheme, scheme.getBuilder().newInstance(IAtomContainerSet.class));
    }
1308126
protected void checkHttpSchemeSpecificPartSlashPrefix(final URI base,
            final String scheme, final String schemeSpecificPart)
    throws URIException {
        if (scheme == null || scheme.length() <= 0) {
            return;
        }
        if (!scheme.equals("http") && !scheme.equals("https")) {
            return;
        }
        if ( schemeSpecificPart == null 
                || !schemeSpecificPart.startsWith("//")) {
            // only acceptable if schemes match
            if (base == null || !scheme.equals(base.getScheme())) {
                throw new URIException(
                        "relative URI with scheme only allowed for " +
                        "scheme matching base");
            } 
            return; 
        }
        if (schemeSpecificPart.length() <= 2) {
            throw new URIException("http scheme specific part is " +
                "too short: " + schemeSpecificPart);
        }
    }
112203
function setScheme($scheme)
    {
        if ($scheme !== null)
            $scheme = $this->_filterScheme((string) $scheme);

        $this->scheme = $scheme;
        return $this;
    }
942033
public PathImpl put(String scheme, PathImpl path)
  {
    SchemeRoot oldRoot = getUpdateMap().put(scheme, new SchemeRoot(path));
    
    return oldRoot != null ? oldRoot.getRoot() : null;
  }
1200808
public function withScheme(string $scheme): UriInterface
    {
        $scheme = $this->marshalScheme($scheme);

        if ( $this->scheme === $scheme ) {
            return $this;
        }

        $instance = clone $this;
        $instance->scheme = $scheme;
        $instance->calibratePort();

        return $instance;
    }
447377
SamlPortConfigBuilder setSchemeIfAbsent(SessionProtocol scheme) {
        requireNonNull(scheme, "scheme");
        if (this.scheme == null) {
            if (scheme == SessionProtocol.HTTPS ||
                scheme == SessionProtocol.HTTP) {
                this.scheme = scheme;
            } else {
                throw new IllegalArgumentException("unexpected session protocol: " + scheme);
            }
        }
        return this;
    }
493471
public UriComponentsBuilder uri(URI uri) {
		Assert.notNull(uri, "'uri' must not be null");
		this.scheme = uri.getScheme();
		if (uri.isOpaque()) {
			this.ssp = uri.getRawSchemeSpecificPart();
			resetHierarchicalComponents();
		}
		else {
			if (uri.getRawUserInfo() != null) {
				this.userInfo = uri.getRawUserInfo();
			}
			if (uri.getHost() != null) {
				this.host = uri.getHost();
			}
			if (uri.getPort() != -1) {
				this.port = String.valueOf(uri.getPort());
			}
			if (StringUtils.hasLength(uri.getRawPath())) {
				this.pathBuilder = new CompositePathComponentBuilder(uri.getRawPath());
			}
			if (StringUtils.hasLength(uri.getRawQuery())) {
				this.queryParams.clear();
				query(uri.getRawQuery());
			}
			resetSchemeSpecificPart();
		}
		if (uri.getRawFragment() != null) {
			this.fragment = uri.getRawFragment();
		}
		return this;
	}
1163472
def build_url (self):
        """"""
        super(UnknownUrl, self).build_url()
        if self.is_ignored():
            self.add_info(_("%(scheme)s URL ignored.") %
                          {"scheme": self.scheme.capitalize()})
            self.set_result(_("ignored"))
        else:
            self.set_result(_("URL is unrecognized or has invalid syntax"),
                        valid=False)
1347433
public void loadSubjectScheme(final File scheme) {
        assert scheme.isAbsolute();
        if (!scheme.exists()) {
            throw new IllegalStateException();
        }
        logger.debug("Load subject scheme " + scheme);

        try {
            final DocumentBuilder builder = XMLUtils.getDocumentBuilder();
            final Document doc = builder.parse(scheme);
            final Element schemeRoot = doc.getDocumentElement();
            if (schemeRoot == null) {
                return;
            }
            loadSubjectScheme(schemeRoot);
        } catch (final RuntimeException e) {
            throw e;
        } catch (final Exception e) {
            logger.error(e.getMessage(), e) ;
        }
    }
987289
@Nonnull
  public CSP2SourceList addScheme (@Nonnull @Nonempty final String sScheme)
  {
    ValueEnforcer.notEmpty (sScheme, "Scheme");
    ValueEnforcer.isTrue (sScheme.length () > 1 && sScheme.endsWith (":"),
                          () -> "Passed scheme '" + sScheme + "' is invalid!");
    m_aList.add (sScheme);
    return this;
  }
701257
public function withScheme($scheme)
    {
        $scheme = str_replace('://', '', strtolower((string)$scheme));

        if (!empty($scheme) && !array_key_exists($scheme, $this->schemes)) {
            throw new InvalidArgumentException('Invalid scheme provided.');
        }

        return $this->_clone('scheme', $scheme);
    }
1063062
@Override
  public PathImpl schemeWalk(String userPath,
                         Map<String,Object> newAttributes,
                         String uri,
                         int offset)
  {
    int length = uri.length();

    if (length < 2 + offset
        || uri.charAt(offset) != '/'
        || uri.charAt(1 + offset) != '/')
      throw new RuntimeException("bad scheme");

    CharBuffer buf = new CharBuffer();
    int i = 2 + offset;
    int ch = 0;
    boolean isIpv6 = false;
    
    for (; 
          (i < length
           && (ch = uri.charAt(i)) != '/'
           && ch != '?'
           && ! (ch == ':' && ! isIpv6));
         i++) {
      if (ch == '[')
        isIpv6 = true;
      else if (ch == ']')
        isIpv6 = false;
      
      buf.append((char) ch);
    }

    String host = buf.toString();
    if (host.length() == 0)
      throw new RuntimeException("bad host");

    int port = 0;
    if (ch == ':') {
      for (i++; i < length && (ch = uri.charAt(i)) >= '0' && ch <= '9'; i++) {
        port = 10 * port + uri.charAt(i) - '0';
      }
    }

    return create(this, userPath, newAttributes, host, port);
  }
1257824
public function setScheme($scheme)
        {
            if (null !== $scheme && !is_string($scheme)) {
                require_once 'Zend/Navigation/Exception.php';
                throw new Exception(
                    'Invalid argument: $scheme must be a string or null'
                );
            }

            $this->_scheme = $scheme;
            return $this;
        }