Class IPConfiguration


  • public class IPConfiguration
    extends Object
    An IP configuration describes the settings of a network interface.
    • Constructor Detail

      • IPConfiguration

        public IPConfiguration()
    • Method Detail

      • getDNS

        @Nullable
        public InetAddress[] getDNS()
        Gets the DNS server addresses.
        Returns:
        the DNS addresses or null if not set.
      • getGateway

        @Nullable
        public InetAddress getGateway()
        Gets the gateway address.
        Returns:
        the gateway address or null if not set.
      • getIP

        @Nullable
        public InetAddress getIP()
        Gets the IP address.
        Returns:
        the IP address or null if not set.
      • getNetmask

        @Nullable
        public InetAddress getNetmask()
        Gets the netmask.
        Returns:
        the netmask or null if not set.
      • isDNSStatic

        public boolean isDNSStatic()
        Tells whether the DNS server address is statically configured or retrieved from DHCP server. When DHCP is not used (see isStatic(), the return of this method is not relevant.
        Returns:
        true for static DNS configuration, false if DHCP is used also for DNS.
      • isStatic

        public boolean isStatic()
        Tells whether the IP configuration is set statically or retrieved from a DHCP server.
        Returns:
        true for static configuration, false if DHCP is used.
      • setDNS

        public void setDNS​(@Nullable
                           InetAddress[] dnsList)
        Sets the addresses of the DNS servers.
        Parameters:
        dnsList - the addresses of the DNS servers or null.
      • setGateway

        public void setGateway​(@Nullable
                               InetAddress gateway)
        Sets the IP address of the gateway.
        Parameters:
        gateway - the IP address of the gateway or null.
      • setIP

        public void setIP​(@Nullable
                          InetAddress ip)
        Sets the IP address.
        Parameters:
        ip - the IP address or null.
      • setNetmask

        public void setNetmask​(@Nullable
                               InetAddress netmask)
        Sets the netmask.
        Parameters:
        netmask - the netmask or null.
      • useDHCP

        public void useDHCP​(boolean use)
        Forces the use of DHCP or not.
        Parameters:
        use - true to use DHCP, false for a static configuration.
        See Also:
        setIP(InetAddress)
      • useStaticDNS

        public void useStaticDNS​(boolean use)
        Selects the DNS configuration between a static statically configured DNS and the DNS given by DHCP server.
        Parameters:
        use - true to use a static DNS, false for a dynamic one.
        See Also:
        setDNS(InetAddress[])