Package org.apache.commons.net.util
Class SubnetUtils6.SubnetInfo
- java.lang.Object
-
- org.apache.commons.net.util.SubnetUtils6.SubnetInfo
-
- Enclosing class:
- SubnetUtils6
public final class SubnetUtils6.SubnetInfo extends java.lang.ObjectContains IPv6 subnet summary information.
-
-
Constructor Summary
Constructors Modifier Constructor Description privateSubnetInfo()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetAddress()Gets the address used to initialize this subnet.java.math.BigIntegergetAddressCount()Gets the count of available addresses in this subnet.java.lang.StringgetCidrSignature()Gets the CIDR notation for this subnet.java.lang.StringgetHighAddress()Gets the highest address in this subnet.java.lang.StringgetLowAddress()Gets the lowest address in this subnet (the network address).java.lang.StringgetNetworkAddress()Gets the network address for this subnet.intgetPrefixLength()Gets the prefix length for this subnet.booleanisInRange(byte[] addr)Tests if the given address is within this subnet range.booleanisInRange(java.lang.String addr)Tests if the given address is within this subnet range.booleanisInRange(java.math.BigInteger addr)Tests if the given address is within this subnet range.booleanisInRange(java.net.Inet6Address addr)Tests if the given address is within this subnet range.java.lang.StringtoString()Returns a summary of this subnet for debugging.
-
-
-
Method Detail
-
getAddress
public java.lang.String getAddress()
Gets the address used to initialize this subnet.- Returns:
- the address as a string in standard IPv6 format.
-
getAddressCount
public java.math.BigInteger getAddressCount()
Gets the count of available addresses in this subnet.For IPv6, this can be astronomically large. A /64 subnet has 2^64 addresses.
- Returns:
- the count of addresses as a BigInteger.
-
getCidrSignature
public java.lang.String getCidrSignature()
Gets the CIDR notation for this subnet.- Returns:
- the CIDR signature (e.g., "2001:db8::1/64").
-
getHighAddress
public java.lang.String getHighAddress()
Gets the highest address in this subnet.- Returns:
- the high address as a string in standard IPv6 format.
-
getLowAddress
public java.lang.String getLowAddress()
Gets the lowest address in this subnet (the network address).- Returns:
- the low address as a string in standard IPv6 format.
-
getNetworkAddress
public java.lang.String getNetworkAddress()
Gets the network address for this subnet.- Returns:
- the network address as a string in standard IPv6 format.
-
getPrefixLength
public int getPrefixLength()
Gets the prefix length for this subnet.- Returns:
- the prefix length (0-128).
-
isInRange
public boolean isInRange(java.math.BigInteger addr)
Tests if the given address is within this subnet range.- Parameters:
addr- the IPv6 address to test (as a BigInteger).- Returns:
- true if the address is in range.
-
isInRange
public boolean isInRange(byte[] addr)
Tests if the given address is within this subnet range.- Parameters:
addr- the IPv6 address to test as a byte array (16 bytes).- Returns:
- true if the address is in range.
-
isInRange
public boolean isInRange(java.net.Inet6Address addr)
Tests if the given address is within this subnet range.- Parameters:
addr- the IPv6 address to test.- Returns:
- true if the address is in range.
-
isInRange
public boolean isInRange(java.lang.String addr)
Tests if the given address is within this subnet range.- Parameters:
addr- the IPv6 address to test as a string.- Returns:
- true if the address is in range.
- Throws:
java.lang.IllegalArgumentException- if the address cannot be parsed.
-
toString
public java.lang.String toString()
Returns a summary of this subnet for debugging.- Overrides:
toStringin classjava.lang.Object- Returns:
- a multi-line debug string summarizing this subnet.
-
-