Package org.drasyl.util.network
Class Subnet
- java.lang.Object
-
- org.drasyl.util.network.Subnet
-
public class Subnet extends Object
Represents an IP range..
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description InetAddress
address()
boolean
contains(InetAddress address)
Returnstrue
ifaddress
is part of this subnet.InetAddress
first()
Returns the firstInetAddress
of this subnetwork.InetAddress
last()
Returns the lastInetAddress
of this subnetwork.InetAddress
netmask()
int
netmaskLength()
InetAddress
network()
int
networkSize()
Returns the size of this subnetwork.InetAddress
nth(int n)
Returns then
-thInetAddress
of this subnetwork.String
toString()
-
-
-
Constructor Detail
-
Subnet
public Subnet(String subnet) throws UnknownHostException
- Parameters:
subnet
- subnet in CIDR notation- Throws:
UnknownHostException
-
-
Method Detail
-
address
public InetAddress address()
-
netmaskLength
public int netmaskLength()
-
network
public InetAddress network()
-
netmask
public InetAddress netmask()
-
networkSize
public int networkSize()
Returns the size of this subnetwork.
-
nth
public InetAddress nth(int n)
Returns then
-thInetAddress
of this subnetwork.
-
first
public InetAddress first()
Returns the firstInetAddress
of this subnetwork.
-
last
public InetAddress last()
Returns the lastInetAddress
of this subnetwork.
-
contains
public boolean contains(InetAddress address)
Returnstrue
ifaddress
is part of this subnet.
-
-