Java InetAddress Check isLocalIpAddress(final InetAddress ipAddress)

Here you can find the source of isLocalIpAddress(final InetAddress ipAddress)

Description

is Local Ip Address

License

Apache License

Declaration

private static boolean isLocalIpAddress(final InetAddress ipAddress) 

Method Source Code


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

import java.net.InetAddress;

public class Main {
    private static boolean isLocalIpAddress(final InetAddress ipAddress) {
        return ipAddress.isSiteLocalAddress() && !ipAddress.isLoopbackAddress() && !isV6IpAddress(ipAddress);
    }//from ww  w  . j  ava  2 s .c  o m

    private static boolean isV6IpAddress(final InetAddress ipAddress) {
        return ipAddress.getHostAddress().contains(":");
    }
}

Related

  1. isLocalAddress(InetAddress addr)
  2. isLocalAddress(InetAddress addr)
  3. isLocalAddress(InetAddress address)
  4. isLocalAddress(InetAddress address)
  5. isLocalIP(final InetAddress ip1, final InetAddress ip2, final int mask)
  6. isLoopbackAddress(InetAddress address)
  7. isLoopbackIp(InetAddress addr)
  8. isMulticastAddress(InetAddress ipAddr)
  9. isOnNetwork(InetAddress host, InetAddress network, byte[] mask)