Java InetAddress Check isPubliclyRoutable(final InetAddress addrIP)

Here you can find the source of isPubliclyRoutable(final InetAddress addrIP)

Description

Determines whether a particular IP address is publicly routable on the internet

License

Open Source License

Parameter

Parameter Description
addrIP a parameter

Declaration

public static boolean isPubliclyRoutable(final InetAddress addrIP) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.net.InetAddress;

public class Main {
    /**//  www  .ja  v a  2s  . c om
     * Determines whether a particular IP address is publicly routable on the internet
     *
     * @param addrIP
     *
     * @return
     */
    public static boolean isPubliclyRoutable(final InetAddress addrIP) {
        if (addrIP == null)
            throw new NullPointerException("isPubliclyRoutable requires an IP address be passed to it!");
        return !addrIP.isSiteLocalAddress() && !addrIP.isLinkLocalAddress() && !addrIP.isLoopbackAddress();
    }
}

Related

  1. isPrivateNetworkAddress(final InetAddress inetAddress)
  2. isPrivateSubnet(InetAddress address)
  3. isPublic(InetAddress inetAddress)
  4. isPublicIp(InetAddress addr)
  5. isPublicIP4Address(InetAddress localAddress)
  6. isReachable(final InetAddress inetAddress, final int timeout)
  7. isReachable(InetAddress address, int port)
  8. isReachable(NetworkInterface iface, InetAddress address, int timeout)
  9. isReservedAddr(InetAddress inetAddr)