Java 类org.apache.http.conn.util.InetAddressUtilsHC4 实例源码

项目:remote-files-sync    文件:AbstractVerifierHC4.java   
private String normaliseIPv6Address(final String hostname) {
    if (hostname == null || !InetAddressUtilsHC4.isIPv6Address(hostname)) {
        return hostname;
    }
    try {
        final InetAddress inetAddress = InetAddress.getByName(hostname);
        return inetAddress.getHostAddress();
    } catch (final UnknownHostException uhe) { // Should not happen, because we check for IPv6 address above
        Log.e(TAG, "Unexpected error converting "+hostname, uhe);
        return hostname;
    }
}
项目:Visit    文件:AbstractVerifierHC4.java   
private String normaliseIPv6Address(final String hostname) {
    if (hostname == null || !InetAddressUtilsHC4.isIPv6Address(hostname)) {
        return hostname;
    }
    try {
        final InetAddress inetAddress = InetAddress.getByName(hostname);
        return inetAddress.getHostAddress();
    } catch (final UnknownHostException uhe) { // Should not happen, because we check for IPv6 address above
        Log.e(TAG, "Unexpected error converting "+hostname, uhe);
        return hostname;
    }
}
项目:ZTLib    文件:AbstractVerifierHC4.java   
private String normaliseIPv6Address(final String hostname) {
    if (hostname == null || !InetAddressUtilsHC4.isIPv6Address(hostname)) {
        return hostname;
    }
    try {
        final InetAddress inetAddress = InetAddress.getByName(hostname);
        return inetAddress.getHostAddress();
    } catch (final UnknownHostException uhe) { // Should not happen, because we check for IPv6 address above
        Log.e(TAG, "Unexpected error converting "+hostname, uhe);
        return hostname;
    }
}
项目:remote-files-sync    文件:URIBuilder.java   
private String buildString() {
    final StringBuilder sb = new StringBuilder();
    if (this.scheme != null) {
        sb.append(this.scheme).append(':');
    }
    if (this.encodedSchemeSpecificPart != null) {
        sb.append(this.encodedSchemeSpecificPart);
    } else {
        if (this.encodedAuthority != null) {
            sb.append("//").append(this.encodedAuthority);
        } else if (this.host != null) {
            sb.append("//");
            if (this.encodedUserInfo != null) {
                sb.append(this.encodedUserInfo).append("@");
            } else if (this.userInfo != null) {
                sb.append(encodeUserInfo(this.userInfo)).append("@");
            }
            if (InetAddressUtilsHC4.isIPv6Address(this.host)) {
                sb.append("[").append(this.host).append("]");
            } else {
                sb.append(this.host);
            }
            if (this.port >= 0) {
                sb.append(":").append(this.port);
            }
        }
        if (this.encodedPath != null) {
            sb.append(normalizePath(this.encodedPath));
        } else if (this.path != null) {
            sb.append(encodePath(normalizePath(this.path)));
        }
        if (this.encodedQuery != null) {
            sb.append("?").append(this.encodedQuery);
        } else if (this.queryParams != null) {
            sb.append("?").append(encodeUrlForm(this.queryParams));
        } else if (this.query != null) {
            sb.append("?").append(encodeUric(this.query));
        }
    }
    if (this.encodedFragment != null) {
        sb.append("#").append(this.encodedFragment);
    } else if (this.fragment != null) {
        sb.append("#").append(encodeUric(this.fragment));
    }
    return sb.toString();
}
项目:remote-files-sync    文件:AbstractVerifierHC4.java   
private static boolean isIPAddress(final String hostname) {
    return hostname != null &&
        (InetAddressUtilsHC4.isIPv4Address(hostname) ||
                InetAddressUtilsHC4.isIPv6Address(hostname));
}
项目:Visit    文件:URIBuilder.java   
private String buildString() {
    final StringBuilder sb = new StringBuilder();
    if (this.scheme != null) {
        sb.append(this.scheme).append(':');
    }
    if (this.encodedSchemeSpecificPart != null) {
        sb.append(this.encodedSchemeSpecificPart);
    } else {
        if (this.encodedAuthority != null) {
            sb.append("//").append(this.encodedAuthority);
        } else if (this.host != null) {
            sb.append("//");
            if (this.encodedUserInfo != null) {
                sb.append(this.encodedUserInfo).append("@");
            } else if (this.userInfo != null) {
                sb.append(encodeUserInfo(this.userInfo)).append("@");
            }
            if (InetAddressUtilsHC4.isIPv6Address(this.host)) {
                sb.append("[").append(this.host).append("]");
            } else {
                sb.append(this.host);
            }
            if (this.port >= 0) {
                sb.append(":").append(this.port);
            }
        }
        if (this.encodedPath != null) {
            sb.append(normalizePath(this.encodedPath));
        } else if (this.path != null) {
            sb.append(encodePath(normalizePath(this.path)));
        }
        if (this.encodedQuery != null) {
            sb.append("?").append(this.encodedQuery);
        } else if (this.queryParams != null) {
            sb.append("?").append(encodeUrlForm(this.queryParams));
        } else if (this.query != null) {
            sb.append("?").append(encodeUric(this.query));
        }
    }
    if (this.encodedFragment != null) {
        sb.append("#").append(this.encodedFragment);
    } else if (this.fragment != null) {
        sb.append("#").append(encodeUric(this.fragment));
    }
    return sb.toString();
}
项目:Visit    文件:AbstractVerifierHC4.java   
private static boolean isIPAddress(final String hostname) {
    return hostname != null &&
        (InetAddressUtilsHC4.isIPv4Address(hostname) ||
                InetAddressUtilsHC4.isIPv6Address(hostname));
}
项目:ZTLib    文件:URIBuilder.java   
private String buildString() {
    final StringBuilder sb = new StringBuilder();
    if (this.scheme != null) {
        sb.append(this.scheme).append(':');
    }
    if (this.encodedSchemeSpecificPart != null) {
        sb.append(this.encodedSchemeSpecificPart);
    } else {
        if (this.encodedAuthority != null) {
            sb.append("//").append(this.encodedAuthority);
        } else if (this.host != null) {
            sb.append("//");
            if (this.encodedUserInfo != null) {
                sb.append(this.encodedUserInfo).append("@");
            } else if (this.userInfo != null) {
                sb.append(encodeUserInfo(this.userInfo)).append("@");
            }
            if (InetAddressUtilsHC4.isIPv6Address(this.host)) {
                sb.append("[").append(this.host).append("]");
            } else {
                sb.append(this.host);
            }
            if (this.port >= 0) {
                sb.append(":").append(this.port);
            }
        }
        if (this.encodedPath != null) {
            sb.append(normalizePath(this.encodedPath));
        } else if (this.path != null) {
            sb.append(encodePath(normalizePath(this.path)));
        }
        if (this.encodedQuery != null) {
            sb.append("?").append(this.encodedQuery);
        } else if (this.queryParams != null) {
            sb.append("?").append(encodeUrlForm(this.queryParams));
        } else if (this.query != null) {
            sb.append("?").append(encodeUric(this.query));
        }
    }
    if (this.encodedFragment != null) {
        sb.append("#").append(this.encodedFragment);
    } else if (this.fragment != null) {
        sb.append("#").append(encodeUric(this.fragment));
    }
    return sb.toString();
}
项目:ZTLib    文件:AbstractVerifierHC4.java   
private static boolean isIPAddress(final String hostname) {
    return hostname != null &&
        (InetAddressUtilsHC4.isIPv4Address(hostname) ||
                InetAddressUtilsHC4.isIPv6Address(hostname));
}