Class Configuration.Network

Enclosing class:

public static class Configuration.Network extends Object
A class describing an IPv4 or IPv6 network
  • Field Details

    • address

      public final InetAddress address
    • prefixLength

      public final int prefixLength
  • Constructor Details

  • Method Details

    • fromString

      public static Configuration.Network fromString(String s)
      Creates a network from CIDR notation

      This parses either an IPv4 or IPv6 network in CIDR notation, e.g. or fe80::/10, or if the slash is omitted, it is treated as the subnetwork that only contains that specific address, e.g. is interpreted as

      s - the network in CIDR notation e.g., or fe80::/10
      IllegalArgumentException - if the address can not be parsed or the prefix length is not valid for the type of IP address
    • contains

      public boolean contains(InetAddress address)
      Checks whether this network contains the given address