Class SubnetUtils.SubnetInfo

    • Method Detail

      • asInteger

        public int asInteger​(java.lang.String address)
      • getAddress

        public java.lang.String getAddress()
      • getAddressCount

        @Deprecated
        public int getAddressCount()
        Deprecated.
        (3.4) use getAddressCountLong() instead
        Gets the count of available addresses. Will be zero for CIDR/31 and CIDR/32 if the inclusive flag is false.
        Returns:
        the count of addresses, may be zero.
        Throws:
        java.lang.RuntimeException - if the correct count is greater than Integer.MAX_VALUE
      • getAddressCountLong

        public long getAddressCountLong()
        Gets the count of available addresses. Will be zero for CIDR/31 and CIDR/32 if the inclusive flag is false.
        Returns:
        the count of addresses, may be zero.
        Since:
        3.4
      • getHighAddress

        public java.lang.String getHighAddress()
        Gets the high address as a dotted IP address. Will be zero for CIDR/31 and CIDR/32 if the inclusive flag is false.
        Returns:
        the IP address in dotted format, may be "0.0.0.0" if there is no valid address
      • getLowAddress

        public java.lang.String getLowAddress()
        Gets the low address as a dotted IP address. Will be zero for CIDR/31 and CIDR/32 if the inclusive flag is false.
        Returns:
        the IP address in dotted format, may be "0.0.0.0" if there is no valid address
      • getNetmask

        public java.lang.String getNetmask()
      • isInRange

        public boolean isInRange​(int address)
        Tests if the parameter address is in the range of usable endpoint addresses for this subnet. This excludes the network and broadcast addresses by default. Use SubnetUtils.setInclusiveHostCount(boolean) to change this.
        Parameters:
        address - the address to check
        Returns:
        true if it is in range
        Since:
        3.4 (made public)
      • isInRange

        public boolean isInRange​(java.lang.String address)
        Tests if the parameter address is in the range of usable endpoint addresses for this subnet. This excludes the network and broadcast addresses. Use SubnetUtils.setInclusiveHostCount(boolean) to change this.
        Parameters:
        address - A dot-delimited IPv4 address, e.g. "192.168.0.1"
        Returns:
        True if in range, false otherwise
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
        Since:
        2.2