Class Network

java.lang.Object
com.maxmind.db.Network

public final class Network extends Object
Network represents an IP network.
  • Constructor Details

    • Network

      public Network(InetAddress ipAddress, int prefixLength)
      Construct a Network
      Parameters:
      ipAddress - An IP address in the network. This does not have to be the first address in the network.
      prefixLength - The prefix length for the network.
  • Method Details

    • getNetworkAddress

      public InetAddress getNetworkAddress()
      Returns:
      The first address in the network.
    • getPrefixLength

      public int getPrefixLength()
      Returns:
      The prefix length is the number of leading 1 bits in the subnet mask. Sometimes also known as netmask length.
    • toString

      public String toString()
      Overrides:
      toString in class Object
      Returns:
      A string representation of the network in CIDR notation, e.g., 1.2.3.0/24 or 2001::/8.