当前位置: 首页>>代码示例>>Java>>正文


Java InetAddressUtilsHC4类代码示例

本文整理汇总了Java中org.apache.http.conn.util.InetAddressUtilsHC4的典型用法代码示例。如果您正苦于以下问题:Java InetAddressUtilsHC4类的具体用法?Java InetAddressUtilsHC4怎么用?Java InetAddressUtilsHC4使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


InetAddressUtilsHC4类属于org.apache.http.conn.util包,在下文中一共展示了InetAddressUtilsHC4类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: normaliseIPv6Address

import org.apache.http.conn.util.InetAddressUtilsHC4; //导入依赖的package包/类
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;
    }
}
 
开发者ID:xxonehjh,项目名称:remote-files-sync,代码行数:13,代码来源:AbstractVerifierHC4.java

示例2: buildString

import org.apache.http.conn.util.InetAddressUtilsHC4; //导入依赖的package包/类
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();
}
 
开发者ID:xxonehjh,项目名称:remote-files-sync,代码行数:47,代码来源:URIBuilder.java

示例3: isIPAddress

import org.apache.http.conn.util.InetAddressUtilsHC4; //导入依赖的package包/类
private static boolean isIPAddress(final String hostname) {
    return hostname != null &&
        (InetAddressUtilsHC4.isIPv4Address(hostname) ||
                InetAddressUtilsHC4.isIPv6Address(hostname));
}
 
开发者ID:xxonehjh,项目名称:remote-files-sync,代码行数:6,代码来源:AbstractVerifierHC4.java


注:本文中的org.apache.http.conn.util.InetAddressUtilsHC4类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。