Class IpAddress

java.lang.Object
ru.bgcrm.util.inet.IpAddress
All Implemented Interfaces:
Serializable, Comparable<IpAddress>

public class IpAddress extends Object implements Comparable<IpAddress>, Serializable
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    byte[]
     
    static final Comparator<byte[]>
     
    static final IpAddress
     
    static final IpAddress
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
    IpAddress(byte[] address)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
     
    static final int
    compare(byte[] v1, byte[] v2)
     
    static final int
    compare(byte[] v1, int i, int len1, byte[] v2, int j, int len2)
     
    int
     
    static byte[]
     
    static BigInteger
    convertIp4AddresToBigInt(byte[] address)
     
    static boolean
    equals(byte[] a, byte[] a2)
     
    boolean
     
    static String
    formatRange(byte[] from, byte[] to)
    Deprecated.
    - use
    invalid reference
    IpResourceRange#toString(byte[], byte[])
    Форматирует диапазон адресов к виду от-до.
    static String
    Deprecated.
    - use
    invalid reference
    IpResourceRange#toString(IpAddress, IpAddress)
    Форматирует диапазон адресов к виду от-до.
    int
     
    static int
    hashCode(byte[] a)
     
    static boolean
    increment(byte[] ip)
     
    static boolean
    increment(byte[] ip, int fromBit)
     
    static boolean
    instersect(byte[] addressFrom, byte[] addressTo, byte[] addressFrom2, byte[] addressTo2)
    Deprecated.
    - use
    invalid reference
    IpResourceRange#intersects(byte[], byte[], byte[], byte[])
    функция пересечения отрезков.
    static boolean
    ipInRange(byte[] ip, byte[] addressFrom, byte[] addressTo)
    Deprecated.
    - use
    invalid reference
    IpResourceRange#inRange(byte[], byte[], byte[], byte[])
    static byte[]
    newAndDecrement(byte[] ip)
     
    static byte[]
    newAndIncrement(byte[] ip)
     
    static boolean
    rangeInRange(byte[] addressFrom, byte[] addressTo, byte[] addressFrom2, byte[] addressTo2)
    Deprecated.
    - use
    invalid reference
    IpResourceRange#inRange(byte[], byte[], byte[], byte[])
    функция вхождения одного отрезка в другой.
     
    static String
    toString(byte[] address)
     
    static void
    toString(byte[] address, StringBuilder sb)
     

    Methods inherited from class java.lang.Object

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

    • ZERO_ADDRESS

      public static final IpAddress ZERO_ADDRESS
    • IPV6_ZERO_ADDRESS

      public static final IpAddress IPV6_ZERO_ADDRESS
    • address

      public byte[] address
    • comparator

      public static final Comparator<byte[]> comparator
  • Constructor Details

    • IpAddress

      public IpAddress()
    • IpAddress

      public IpAddress(byte[] address)
  • Method Details

    • hashCode

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

      public static int hashCode(byte[] a)
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • equals

      public static boolean equals(byte[] a, byte[] a2)
    • clear

      public void clear()
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • toString

      public static String toString(byte[] address)
    • toString

      public static void toString(byte[] address, StringBuilder sb)
    • compare

      public static final int compare(byte[] v1, byte[] v2)
    • compare

      public static final int compare(byte[] v1, int i, int len1, byte[] v2, int j, int len2)
    • newAndIncrement

      public static byte[] newAndIncrement(byte[] ip)
    • increment

      public static boolean increment(byte[] ip)
    • increment

      public static boolean increment(byte[] ip, int fromBit)
    • newAndDecrement

      public static byte[] newAndDecrement(byte[] ip)
    • compareTo

      public int compareTo(IpAddress o)
      Specified by:
      compareTo in interface Comparable<IpAddress>
    • clone

      public IpAddress clone()
      Overrides:
      clone in class Object
    • instersect

      @Deprecated public static boolean instersect(byte[] addressFrom, byte[] addressTo, byte[] addressFrom2, byte[] addressTo2)
      Deprecated.
      - use
      invalid reference
      IpResourceRange#intersects(byte[], byte[], byte[], byte[])
      функция пересечения отрезков. Все параметры не пустые , иначе NullPointerException
      Parameters:
      addressFrom -
      addressTo -
      addressFrom2 -
      addressTo2 -
      Returns:
    • rangeInRange

      @Deprecated public static boolean rangeInRange(byte[] addressFrom, byte[] addressTo, byte[] addressFrom2, byte[] addressTo2)
      Deprecated.
      - use
      invalid reference
      IpResourceRange#inRange(byte[], byte[], byte[], byte[])
      функция вхождения одного отрезка в другой. Все параметры не пустые , иначе NullPointerException.
      Parameters:
      addressFrom -
      addressTo -
      addressFrom2 -
      addressTo2 -
      Returns:
    • ipInRange

      @Deprecated public static boolean ipInRange(byte[] ip, byte[] addressFrom, byte[] addressTo)
      Deprecated.
      - use
      invalid reference
      IpResourceRange#inRange(byte[], byte[], byte[], byte[])
      Parameters:
      ip -
      addressFrom -
      addressTo -
      Returns:
    • convertIp4AddresToBigInt

      public static BigInteger convertIp4AddresToBigInt(byte[] address)
      Parameters:
      address -
      Returns:
    • convertBigIntToIp4Address

      public static byte[] convertBigIntToIp4Address(BigInteger bigInteger)
      Parameters:
      bigInteger -
      Returns:
    • formatRange

      @Deprecated public static String formatRange(IpAddress from, IpAddress to)
      Deprecated.
      - use
      invalid reference
      IpResourceRange#toString(IpAddress, IpAddress)
      Форматирует диапазон адресов к виду от-до.
      Parameters:
      from -
      to -
      Returns:
    • formatRange

      @Deprecated public static String formatRange(byte[] from, byte[] to)
      Deprecated.
      - use
      invalid reference
      IpResourceRange#toString(byte[], byte[])
      Форматирует диапазон адресов к виду от-до.
      Parameters:
      from -
      to -
      Returns: