Class Subnet


  • public class Subnet
    extends java.lang.Object
    A IP subnet using the CIDR notation. Currently, only IP version 4 address are supported.
    Author:
    Apache MINA Project
    • Constructor Summary

      Constructors 
      Constructor Description
      Subnet​(java.net.InetAddress subnet, int mask)
      Creates a subnet from CIDR notation.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object obj)  
      boolean inSubnet​(java.net.InetAddress address)
      Checks if the InetAddress is within this subnet
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

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

      • Subnet

        public Subnet​(java.net.InetAddress subnet,
                      int mask)
        Creates a subnet from CIDR notation. For example, the subnet 192.168.0.0/24 would be created using the InetAddress 192.168.0.0 and the mask 24.
        Parameters:
        subnet - The InetAddress of the subnet
        mask - The mask
    • Method Detail

      • inSubnet

        public boolean inSubnet​(java.net.InetAddress address)
        Checks if the InetAddress is within this subnet
        Parameters:
        address - The InetAddress to check
        Returns:
        True if the address is within this subnet, false otherwise
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
        See Also:
        Object.toString()
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object