public final class SubnetUtils.SubnetInfo extends Object
| Modifier and Type | Method and Description |
|---|---|
int |
asInteger(String address)
Converts a dotted decimal format address to a packed integer format.
|
String |
getAddress()
Gets this instance's address into a dotted decimal String.
|
long |
getAddressCountLong()
Gets the count of available addresses.
|
String[] |
getAllAddresses()
Gets all addresses in this subnet, the return array could be huge.
|
String |
getBroadcastAddress()
Gets the broadcast address for this subnet.
|
String |
getCidrSignature()
Gets the CIDR signature for this subnet.
|
String |
getHighAddress()
Gets the high address as a dotted IP address.
|
String |
getLowAddress()
Gets the low address as a dotted IP address.
|
String |
getNetmask()
Gets the network mask for this subnet.
|
String |
getNetworkAddress()
Gets the network address for this subnet.
|
String |
getNextAddress()
Gets the next address for this subnet.
|
String |
getPreviousAddress()
Gets the previous address for this subnet.
|
boolean |
isInRange(int address)
Tests if the parameter
address is in the range of usable endpoint addresses for this subnet. |
boolean |
isInRange(String address)
Tests if the parameter
address is in the range of usable endpoint addresses for this subnet. |
Iterable<String> |
iterableAddressStrings()
Creates a new Iterable of address Strings.
|
java.util.stream.Stream<String> |
streamAddressStrings()
Creates a new Stream of address Strings.
|
String |
toString() |
public int asInteger(String address)
address - a dotted decimal format address.public String getAddress()
public long getAddressCountLong()
public String[] getAllAddresses()
For large ranges, you can iterate or stream over the addresses instead using iterableAddressStrings() or streamAddressStrings().
iterableAddressStrings(),
streamAddressStrings()public String getBroadcastAddress()
public String getCidrSignature()
public String getHighAddress()
public String getLowAddress()
public String getNetmask()
public String getNetworkAddress()
public String getNextAddress()
public String getPreviousAddress()
public boolean isInRange(int address)
address is in the range of usable endpoint addresses for this subnet. This excludes the network and broadcast
addresses by default. Use SubnetUtils.setInclusiveHostCount(boolean) to change this.address - the address to checkpublic boolean isInRange(String address)
address is in the range of usable endpoint addresses for this subnet. This excludes the network and broadcast
addresses. Use SubnetUtils.setInclusiveHostCount(boolean) to change this.address - A dot-delimited IPv4 address, e.g. "192.168.0.1"public Iterable<String> iterableAddressStrings()
getAllAddresses(),
streamAddressStrings()public java.util.stream.Stream<String> streamAddressStrings()
getAllAddresses(),
iterableAddressStrings()