Code example for InterfaceAddress

Methods: getAddressgetNetworkPrefixLength

0
  public InetAddress getAddress(InterfaceAddress ifaddr)
  { 
    if (ifaddr == null)
      return null; 
 
    return ifaddr.getAddress();
  } 
 
  public InetAddress getAddress()
  { 
    return getAddress(getInterfaceAddress()); 
  } 
 
  public InetAddress getApAddress()
  { 
    return getAddress(getApInterface()); 
  } 
 
  public InetAddress getWiFiAddress()
  { 
    return getAddress(getWiFiInterface()); 
  } 
 
  public short getNetmask(String ifname)
  { 
    return getNetmask(getInterfaceAddress(ifname));
  } 
 
  public short getNetmask(NetworkInterface iface)
  { 
    return getNetmask(getInterfaceAddress(iface));
  } 
 
  public short getNetmask(InterfaceAddress ifaddr)
  { 
    if (ifaddr == null)
      return -1; 
 
    return ifaddr.getNetworkPrefixLength();
  } 
 
  public short getNetmask() 
  { 
    return getNetmask(getInterfaceAddress());