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


Java InetAddress.hashCode方法代码示例

本文整理汇总了Java中java.net.InetAddress.hashCode方法的典型用法代码示例。如果您正苦于以下问题:Java InetAddress.hashCode方法的具体用法?Java InetAddress.hashCode怎么用?Java InetAddress.hashCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.net.InetAddress的用法示例。


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

示例1: hashCode

import java.net.InetAddress; //导入方法依赖的package包/类
/** Compute the hash code for this URLName. */
@Override
public int hashCode() {
	if (this.hashCode != 0) {
		return this.hashCode;
	}
	if (this.protocol != null) {
		this.hashCode += this.protocol.hashCode();
	}
	final InetAddress addr = getHostAddress();
	if (addr != null) {
		this.hashCode += addr.hashCode();
	}
	else if (this.host != null) {
		this.hashCode += this.host.toLowerCase(Locale.ENGLISH).hashCode();
	}
	if (this.username != null) {
		this.hashCode += this.username.hashCode();
	}
	if (this.file != null) {
		this.hashCode += this.file.hashCode();
	}
	this.hashCode += this.port;
	return this.hashCode;
}
 
开发者ID:MiFirma,项目名称:mi-firma-android,代码行数:26,代码来源:URLName.java

示例2: doNameQuery

import java.net.InetAddress; //导入方法依赖的package包/类
static NbtAddress doNameQuery( Name name, InetAddress svr )
                                                throws UnknownHostException {
    NbtAddress addr;

    if( name.hexCode == 0x1d && svr == null ) {
        svr = CLIENT.baddr; // bit of a hack but saves a lookup
    }
    name.srcHashCode = svr != null ? svr.hashCode() : 0;
    addr = getCachedAddress( name );

    if( addr == null ) {
        /* This is almost exactly like InetAddress.java. See the
         * comments there for a description of how the LOOKUP_TABLE prevents
         * redundant queries from going out on the wire.
         */
        if(( addr = (NbtAddress)checkLookupTable( name )) == null ) {
            try {
                addr = CLIENT.getByName( name, svr );
            } catch( UnknownHostException uhe ) {
                addr = UNKNOWN_ADDRESS;
            } finally {
                cacheAddress( name, addr );
                updateLookupTable( name );
            }
        }
    }
    if( addr == UNKNOWN_ADDRESS ) {
        throw new UnknownHostException( name.toString() );
    }
    return addr;
}
 
开发者ID:archos-sa,项目名称:aos-FileCoreLibrary,代码行数:32,代码来源:NbtAddress.java

示例3: isWINS

import java.net.InetAddress; //导入方法依赖的package包/类
public static boolean isWINS( InetAddress svr ) {
    for( int i = 0; svr != null && i < NBNS.length; i++ ) {
        if( svr.hashCode() == NBNS[i].hashCode() ) {
            return true;
        }
    }
    return false;
}
 
开发者ID:archos-sa,项目名称:aos-FileCoreLibrary,代码行数:9,代码来源:NbtAddress.java


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