/** * Returns {@code true} if the URI string has a {@code scheme} component, {@code false} otherwise. * * @param uri the URI string to check for a scheme component * @return {@code true} if the URI string has a {@code scheme} component, {@code false} otherwise. */ private boolean hasScheme(String uri) { int len = uri.length(); for (int i = 0; i < len; i++) { char c = uri.charAt(i); if (c == ':') { return i > 0; } else if (!isSchemeChar(c)) { return false; } } return false; }