org.minidns.util

## Class InetAddressUtil

- java.lang.Object
- - org.minidns.util.InetAddressUtil

-     public class InetAddressUtil
      extends Object

  Utility class for IP address manipulation and validation.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `InetAddressUtil()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static InetAddress` | `convertToInetAddressIfPossible(CharSequence address)` Converts a CharSequence to an InetAddress if it represents a valid IP address.
    `static Inet4Address` | `ipv4From(CharSequence cs)` Creates an Inet4Address from the given CharSequence.
    `static Inet6Address` | `ipv6From(CharSequence cs)` Creates an Inet6Address from the given CharSequence.
    `static boolean` | `isIpAddress(CharSequence address)` Checks if the given CharSequence represents a valid IP address (IPv4 or IPv6).
    `static boolean` | `isIpV4Address(CharSequence address)` Checks if the given CharSequence represents a valid IPv4 address.
    `static boolean` | `isIpV6Address(CharSequence address)` Checks if the given CharSequence represents a valid IPv6 address.
    `static DnsName` | `reverseIpAddressOf(Inet4Address inet4Address)` Creates the reverse DNS name for the given IPv4 address.
    `static DnsName` | `reverseIpAddressOf(Inet6Address inet6Address)` Creates the reverse DNS name for the given IPv6 address.

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

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

- - ### Constructor Detail

    - #### InetAddressUtil

          public InetAddressUtil()

  - ### Method Detail

    - #### convertToInetAddressIfPossible

          public static InetAddress convertToInetAddressIfPossible(CharSequence address)

      Converts a CharSequence to an InetAddress if it represents a valid IP address.
      Parameters:
        `address` - the CharSequence to convert
      Returns:
        the InetAddress if the input is a valid IP address, null otherwise

    - #### ipv4From

          public static Inet4Address ipv4From(CharSequence cs)

      Creates an Inet4Address from the given CharSequence.
      Parameters:
        `cs` - the CharSequence containing the IPv4 address
      Returns:
        the Inet4Address
      Throws:
        `IllegalArgumentException` - if the input is not a valid IPv4 address

    - #### ipv6From

          public static Inet6Address ipv6From(CharSequence cs)

      Creates an Inet6Address from the given CharSequence.
      Parameters:
        `cs` - the CharSequence containing the IPv6 address
      Returns:
        the Inet6Address
      Throws:
        `IllegalArgumentException` - if the input is not a valid IPv6 address

    - #### isIpAddress

          public static boolean isIpAddress(CharSequence address)

      Checks if the given CharSequence represents a valid IP address (IPv4 or IPv6).
      Parameters:
        `address` - the CharSequence to validate
      Returns:
        true if the input is a valid IP address, false otherwise

    - #### isIpV4Address

          public static boolean isIpV4Address(CharSequence address)

      Checks if the given CharSequence represents a valid IPv4 address.
      Parameters:
        `address` - the CharSequence to validate
      Returns:
        true if the input is a valid IPv4 address, false otherwise

    - #### isIpV6Address

          public static boolean isIpV6Address(CharSequence address)

      Checks if the given CharSequence represents a valid IPv6 address.
      Parameters:
        `address` - the CharSequence to validate
      Returns:
        true if the input is a valid IPv6 address, false otherwise

    - #### reverseIpAddressOf

          public static DnsName reverseIpAddressOf(Inet4Address inet4Address)

      Creates the reverse DNS name for the given IPv4 address.
      Parameters:
        `inet4Address` - the IPv4 address
      Returns:
        the reverse DNS name

    - #### reverseIpAddressOf

          public static DnsName reverseIpAddressOf(Inet6Address inet6Address)

      Creates the reverse DNS name for the given IPv6 address.
      Parameters:
        `inet6Address` - the IPv6 address
      Returns:
        the reverse DNS name