org.apache.commons.net.util

## Class SubnetUtils.SubnetInfo

- java.lang.Object
- - org.apache.commons.net.util.SubnetUtils.SubnetInfo

- Enclosing class:
    SubnetUtils

      public final class SubnetUtils.SubnetInfo
      extends Object

  Convenience container for subnet summary information.

- - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `asInteger(String address)`
    `String` | `getAddress()`
    `int` | `getAddressCount()` Deprecated. (3.4) use `getAddressCountLong()` instead
    `long` | `getAddressCountLong()` Get the count of available addresses.
    `String[]` | `getAllAddresses()`
    `String` | `getBroadcastAddress()`
    `String` | `getCidrSignature()`
    `String` | `getHighAddress()` Return the high address as a dotted IP address.
    `String` | `getLowAddress()` Return the low address as a dotted IP address.
    `String` | `getNetmask()`
    `String` | `getNetworkAddress()`
    `String` | `getNextAddress()`
    `String` | `getPreviousAddress()`
    `boolean` | `isInRange(int address)` Returns true if the parameter `address` is in the range of usable endpoint addresses for this subnet.
    `boolean` | `isInRange(String address)` Returns true if the parameter `address` is in the range of usable endpoint addresses for this subnet.
    `String` | `toString()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Method Detail

    - #### isInRange

          public boolean isInRange(String address)

      Returns true 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

    - #### isInRange

          public boolean isInRange(int address)

      Returns true 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)

    - #### getBroadcastAddress

          public String getBroadcastAddress()

    - #### getNetworkAddress

          public String getNetworkAddress()

    - #### getNetmask

          public String getNetmask()

    - #### getAddress

          public String getAddress()

    - #### getNextAddress

          public String getNextAddress()

    - #### getPreviousAddress

          public String getPreviousAddress()

    - #### getLowAddress

          public String getLowAddress()

      Return 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

    - #### getHighAddress

          public String getHighAddress()

      Return 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

    - #### getAddressCount

          @Deprecated
          public int getAddressCount()

      Deprecated. (3.4) use `getAddressCountLong()` instead
      Get 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:
        `RuntimeException` - if the correct count is greater than `Integer.MAX_VALUE`

    - #### getAddressCountLong

          public long getAddressCountLong()

      Get 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

    - #### asInteger

          public int asInteger(String address)

    - #### getCidrSignature

          public String getCidrSignature()

    - #### getAllAddresses

          public String[] getAllAddresses()

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`
      Since:
        2.2

Copyright © 2001–2020 The Apache Software Foundation. All rights reserved.