Package ej.ecom.network
Class IPConfiguration
- java.lang.Object
-
- ej.ecom.network.IPConfiguration
-
public class IPConfiguration extends Object
An IP configuration describes the settings of a network interface.
-
-
Constructor Summary
Constructors Constructor Description IPConfiguration()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description InetAddress[]getDNS()Gets the DNS server addresses.InetAddressgetGateway()Gets the gateway address.InetAddressgetIP()Gets the IP address.InetAddressgetNetmask()Gets the netmask.booleanisDNSStatic()Tells whether the DNS server address is statically configured or retrieved from DHCP server.booleanisStatic()Tells whether the IP configuration is set statically or retrieved from a DHCP server.voidsetDNS(InetAddress[] dnsList)Sets the addresses of the DNS servers.voidsetGateway(InetAddress gateway)Sets the IP address of the gateway.voidsetIP(InetAddress ip)Sets the IP address.voidsetNetmask(InetAddress netmask)Sets the netmask.voiduseDHCP(boolean use)Forces the use of DHCP or not.voiduseStaticDNS(boolean use)Selects the DNS configuration between a static statically configured DNS and the DNS given by DHCP server.
-
-
-
Method Detail
-
getDNS
@Nullable public InetAddress[] getDNS()
Gets the DNS server addresses.- Returns:
- the DNS addresses or
nullif not set.
-
getGateway
@Nullable public InetAddress getGateway()
Gets the gateway address.- Returns:
- the gateway address or
nullif not set.
-
getIP
@Nullable public InetAddress getIP()
Gets the IP address.- Returns:
- the IP address or
nullif not set.
-
getNetmask
@Nullable public InetAddress getNetmask()
Gets the netmask.- Returns:
- the netmask or
nullif 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 (seeisStatic(), the return of this method is not relevant.- Returns:
truefor static DNS configuration,falseif 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:
truefor static configuration,falseif 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 ornull.
-
setGateway
public void setGateway(@Nullable InetAddress gateway)
Sets the IP address of the gateway.- Parameters:
gateway- the IP address of the gateway ornull.
-
setIP
public void setIP(@Nullable InetAddress ip)
Sets the IP address.- Parameters:
ip- the IP address ornull.
-
setNetmask
public void setNetmask(@Nullable InetAddress netmask)
Sets the netmask.- Parameters:
netmask- the netmask ornull.
-
useDHCP
public void useDHCP(boolean use)
Forces the use of DHCP or not.- Parameters:
use-trueto use DHCP,falsefor 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-trueto use a static DNS,falsefor a dynamic one.- See Also:
setDNS(InetAddress[])
-
-