Class IPAddress

java.lang.Object
com.alibaba.druid.support.http.util.IPAddress
All Implemented Interfaces:
Cloneable

public class IPAddress extends Object implements Cloneable
Version:
1.0
Author:
Marcel Dullaart
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected int
    IP address
  • Constructor Summary

    Constructors
    Constructor
    Description
    IPAddress(int address)
     
    IPAddress(String ipAddressStr)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    equals(Object another)
     
    final int
    Return the integer representation of the IP address.
    int
     
    final boolean
    Check if the IP address is belongs to a Class A IP address.
    final boolean
    Check if the IP address is belongs to a Class B IP address.
    final boolean
    Check if the IP address is belongs to a Class C IP address.
    Return the string representation of the IP Address following the common decimal-dotted notation xxx.xxx.xxx.xxx.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • ipAddress

      protected int ipAddress
      IP address
  • Constructor Details

    • IPAddress

      public IPAddress(String ipAddressStr)
    • IPAddress

      public IPAddress(int address)
  • Method Details

    • getIPAddress

      public final int getIPAddress()
      Return the integer representation of the IP address.
      Returns:
      The IP address.
    • toString

      public String toString()
      Return the string representation of the IP Address following the common decimal-dotted notation xxx.xxx.xxx.xxx.
      Overrides:
      toString in class Object
      Returns:
      Return the string representation of the IP address.
    • isClassA

      public final boolean isClassA()
      Check if the IP address is belongs to a Class A IP address.
      Returns:
      Return true if the encapsulated IP address belongs to a class A IP address, otherwise returne false.
    • isClassB

      public final boolean isClassB()
      Check if the IP address is belongs to a Class B IP address.
      Returns:
      Return true if the encapsulated IP address belongs to a class B IP address, otherwise returne false.
    • isClassC

      public final boolean isClassC()
      Check if the IP address is belongs to a Class C IP address.
      Returns:
      Return true if the encapsulated IP address belongs to a class C IP address, otherwise returne false.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object another)
      Overrides:
      equals in class Object