當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。