Class SubnetUtils6.SubnetInfo

  • Enclosing class:
    SubnetUtils6

    public final class SubnetUtils6.SubnetInfo
    extends java.lang.Object
    Contains IPv6 subnet summary information.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private SubnetInfo()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getAddress()
      Gets the address used to initialize this subnet.
      java.math.BigInteger getAddressCount()
      Gets the count of available addresses in this subnet.
      java.lang.String getCidrSignature()
      Gets the CIDR notation for this subnet.
      java.lang.String getHighAddress()
      Gets the highest address in this subnet.
      java.lang.String getLowAddress()
      Gets the lowest address in this subnet (the network address).
      java.lang.String getNetworkAddress()
      Gets the network address for this subnet.
      int getPrefixLength()
      Gets the prefix length for this subnet.
      boolean isInRange​(byte[] addr)
      Tests if the given address is within this subnet range.
      boolean isInRange​(java.lang.String addr)
      Tests if the given address is within this subnet range.
      boolean isInRange​(java.math.BigInteger addr)
      Tests if the given address is within this subnet range.
      boolean isInRange​(java.net.Inet6Address addr)
      Tests if the given address is within this subnet range.
      java.lang.String toString()
      Returns a summary of this subnet for debugging.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • SubnetInfo

        private SubnetInfo()
    • 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:
        toString in class java.lang.Object
        Returns:
        a multi-line debug string summarizing this subnet.