Java InetAddress Check isUnicastAddress(@CheckForNull InetAddress address)

Here you can find the source of isUnicastAddress(@CheckForNull InetAddress address)

Description

Determines whether the given address is a "useful" unicast address.

License

Apache License

Declaration

public static boolean isUnicastAddress(@CheckForNull InetAddress address) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.net.InetAddress;

import javax.annotation.CheckForNull;

public class Main {
    /**//from   w  w w  .  j  av  a 2  s. c  om
     * Determines whether the given address is a "useful" unicast address.
     *
     * Site local is allowed. Loopback is not.
     */
    public static boolean isUnicastAddress(@CheckForNull InetAddress address) {
        return (address != null) && !address.isAnyLocalAddress() && !address.isLoopbackAddress()
                && !address.isMulticastAddress();
    }
}

Related

  1. isSiteLocalAddress(InetAddress i)
  2. isTenDot(InetAddress adr)
  3. isThisMyIpAddress(InetAddress addr)
  4. isThisMyIpAddress(InetAddress addr)
  5. isUDPPortFree(int port, InetAddress addr)
  6. isValidAddress(InetAddress address, int timeoutMs)
  7. isValidAddress(InetAddress i, boolean includeLocalAddressesInNoderefs)
  8. isValidAddress(InetAddress i, boolean includeLocalAddressesInNoderefs)
  9. isValidCiscoWildcard(InetAddress wildcard)