private void parse() throws MalformedUriException {
        int pos;
        String string = this.string;
        if (!schemeValidationPattern.matcher(string).find()) {
            throw new MalformedUriException(string, "invalid scheme");
        }

        if ((pos = string.indexOf('#')) >= 0) {
            fragment = string.substring(pos + 1);
            string = string.substring(0, pos);
        } else {
            fragment = null;
        }

        if ((pos = string.indexOf('?')) >= 0) {
            setQuery(string.substring(pos + 1));
            string = string.substring(0, pos);
        } else {
            setQuery(null);
        }

        pos = string.indexOf(':');
        scheme = string.substring(0, pos);
        string = string.substring(pos + 1);

        if (string.startsWith("//")) {
            string = string.substring(2);
        }

        if (string.equals(""))
            throw new MalformedUriException(string, "missing host or path");

        if (string.charAt(0) == '/') {
            /* file:/// */
            path = string;
        } else {
            if ((pos = string.indexOf('/')) >= 0) {
                path = string.substring(pos);
                string = string.substring(0, pos);
            } else {
                path = "";
            }

            if ((pos = string.indexOf('@')) >= 0) {
                userInfo = string.substring(0, pos);
                string = string.substring(pos + 1);
            } else {
                userInfo = null;
            }

            Endpoint endpoint = new Endpoint(string);
            host = endpoint.getHost();
            port = endpoint.getPort();
        }
    }