Class IpAddress

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<IpAddress>

    public class IpAddress
    extends java.lang.Object
    implements java.lang.Comparable<IpAddress>, java.io.Serializable
    See Also:
    Serialized Form
    • Constructor Summary

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

      All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      void clear()  
      IpAddress clone()  
      static int compare​(byte[] v1, byte[] v2)  
      static int compare​(byte[] v1, int i, int len1, byte[] v2, int j, int len2)  
      int compareTo​(IpAddress o)  
      static byte[] convertBigIntToIp4Address​(java.math.BigInteger bigInteger)  
      static java.math.BigInteger convertIp4AddresToBigInt​(byte[] address)  
      static boolean equals​(byte[] a, byte[] a2)  
      boolean equals​(java.lang.Object obj)  
      static java.lang.String formatRange​(byte[] from, byte[] to)
      Deprecated.
      - use IpResourceRange#toString(byte[], byte[]) Форматирует диапазон адресов к виду от-до.
      static java.lang.String formatRange​(IpAddress from, IpAddress to)
      Deprecated.
      - use IpResourceRange#toString(IpAddress, IpAddress) Форматирует диапазон адресов к виду от-до.
      int hashCode()  
      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 IpResourceRange#intersects(byte[], byte[], byte[], byte[]) функция пересечения отрезков.
      static boolean ipInRange​(byte[] ip, byte[] addressFrom, byte[] addressTo)
      Deprecated.
      - use 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 IpResourceRange#inRange(byte[], byte[], byte[], byte[]) функция вхождения одного отрезка в другой.
      java.lang.String toString()  
      static java.lang.String toString​(byte[] address)  
      static void toString​(byte[] address, java.lang.StringBuilder sb)  
      • Methods inherited from class java.lang.Object

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

      • 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 java.util.Comparator<byte[]> comparator
    • Constructor Detail

      • IpAddress

        public IpAddress()
      • IpAddress

        public IpAddress​(byte[] address)
    • Method Detail

      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • hashCode

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

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • equals

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

        public void clear()
      • toString

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

        public static java.lang.String toString​(byte[] address)
      • toString

        public static void toString​(byte[] address,
                                    java.lang.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 java.lang.Comparable<IpAddress>
      • clone

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

        @Deprecated
        public static boolean instersect​(byte[] addressFrom,
                                         byte[] addressTo,
                                         byte[] addressFrom2,
                                         byte[] addressTo2)
        Deprecated.
        - use 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 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 IpResourceRange#inRange(byte[], byte[], byte[], byte[])
        Parameters:
        ip -
        addressFrom -
        addressTo -
        Returns:
      • convertIp4AddresToBigInt

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

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

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

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