Code example for InetAddress

Methods: getAddress

0
	 * [Oracle|Open]JDK up to 8 contains obsolete check for site-local ipv6 
	 * addresses, this repaces it with correct one. 
	 */ 
	public static boolean isSiteLocalAddress(InetAddress i) {
	    if(i instanceof Inet6Address) {
			byte [] addr = i.getAddress();
			assert(addr.length == 128/8);
			// XXX what about ipv6-mapped ipv4 site-local addresses? 
			// (weird/insane/not-sure-if-possible-but) 
			/* 
			try { 
				if(addr[0] == (byte)0x20 && addr[1] == (byte)0x02) { 
					// 2002::/16, 6to4 tunnels 
					return InetAddress.getByAddress( 
						Arrays.copyOfRange(addr,2,6)).isSiteLocalAddress(); 
				} 
				if(addr[ 0] == (byte)0 && addr[ 1] == (byte)0 && 
				   addr[ 2] == (byte)0 && addr[ 3] == (byte)0 && 
				   addr[ 4] == (byte)0 && addr[ 5] == (byte)0 && 
				   addr[ 6] == (byte)0 && addr[ 7] == (byte)0 && 
				   addr[ 8] == (byte)0 && addr[ 9] == (byte)0 &&