Package org.apache.commons.net.util

# Class SubnetUtils6

java.lang.Object
org.apache.commons.net.util.SubnetUtils6

public class SubnetUtils6 extends Object
Performs subnet calculations given an IPv6 network address and a prefix length.

This is the IPv6 equivalent of `SubnetUtils`. Addresses are parsed and formatted using `InetAddress`, which accepts the text representations described in RFC 5952.

Since:
  3.13.0
See Also:
  - `SubnetUtils`
  - RFC 5952 - A Recommendation for IPv6 Address Text Representation

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `final class`
  `SubnetUtils6.SubnetInfo`
  Contains IPv6 subnet summary information.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `SubnetUtils6(String cidrNotation)`
  Constructs an instance from a CIDR-notation string, e.g., "2001:db8::1/64".
  `SubnetUtils6(String address, int prefixLength)`
  Constructs an instance from an IPv6 address and prefix length.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `SubnetUtils6.SubnetInfo`
  `getInfo()`
  Gets a `SubnetUtils6.SubnetInfo` instance that contains subnet-specific statistics.
  `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 Details

  - ### SubnetUtils6

    public SubnetUtils6(String cidrNotation)
    Constructs an instance from a CIDR-notation string, e.g., "2001:db8::1/64".
    Parameters:
      `cidrNotation` - a CIDR-notation string, e.g., "2001:db8::1/64".
    Throws:
      `IllegalArgumentException` - if the parameter is invalid.

  - ### SubnetUtils6

    public SubnetUtils6(String address, int prefixLength)
    Constructs an instance from an IPv6 address and prefix length.
    Parameters:
      `address` - an IPv6 address, e.g., "2001:db8::1".
      `prefixLength` - the prefix length (0-128).
    Throws:
      `IllegalArgumentException` - if the parameters are invalid.

- ## Method Details

  - ### getInfo

    public SubnetUtils6.SubnetInfo getInfo()
    Gets a `SubnetUtils6.SubnetInfo` instance that contains subnet-specific statistics.
    Returns:
      a new SubnetInfo instance.

  - ### toString

    public String toString()
    Returns a summary of this subnet for debugging.

    Delegates to `SubnetUtils6.SubnetInfo.toString()`. This is a diagnostic format and is not suitable for parsing. Use `SubnetUtils6.SubnetInfo.getCidrSignature()` to obtain a string that can be fed back into `SubnetUtils6(String)`.

    Overrides:
      `toString` in class `Object`
    Returns:
      a multi-line debug string summarizing this subnet.