public Address()

in proton-j/src/main/java/org/apache/qpid/proton/reactor/impl/Address.java [56:116]


    public Address(String address)
    {
        clear();
        int start = 0;
        int schemeEnd = address.indexOf("://", start);
        if (schemeEnd >= 0) {
            _scheme = address.substring(start, schemeEnd);
            start = schemeEnd + 3;
        }

        String uphp;
        int slash = address.indexOf("/", start);
        if (slash >= 0) {
            uphp = address.substring(start, slash);
            _name = address.substring(slash + 1);
        } else {
            uphp = address.substring(start);
        }

        String hp;
        int at = uphp.indexOf('@');
        if (at >= 0) {
            String up = uphp.substring(0, at);
            hp = uphp.substring(at + 1);

            int colon = up.indexOf(':');
            if (colon >= 0) {
                _user = up.substring(0, colon);
                _pass = up.substring(colon + 1);
            } else {
                _user = up;
            }
        } else {
            hp = uphp;
        }

        if (hp.startsWith("[")) {
            int close = hp.indexOf(']');
            if (close >= 0) {
                _host = hp.substring(1, close);
                if (hp.substring(close + 1).startsWith(":")) {
                    _port = hp.substring(close + 2);
                }
            }
        }

        if (_host == null) {
            int colon = hp.indexOf(':');
            if (colon >= 0) {
                _host = hp.substring(0, colon);
                _port = hp.substring(colon + 1);
            } else {
                _host = hp;
            }
        }

        if (_host.startsWith("~")) {
            _host = _host.substring(1);
            _passive = true;
        }
    }