Class ImmutableIPAddress

    • Field Detail

      • m_inetAddress

        protected final java.net.InetAddress m_inetAddress
    • Constructor Detail

      • ImmutableIPAddress

        public ImmutableIPAddress​(java.lang.String dottedNotation)
      • ImmutableIPAddress

        public ImmutableIPAddress​(java.net.InetAddress inetAddress)
      • ImmutableIPAddress

        public ImmutableIPAddress​(byte[] ipAddrOctets)
    • Method Detail

      • toInetAddress

        public java.net.InetAddress toInetAddress()
      • toOctets

        public byte[] toOctets()
      • equals

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

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

        public java.lang.String toUserString()
      • toString

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

        public java.lang.String toDbString()
      • toBigInteger

        public java.math.BigInteger toBigInteger()
      • incr

        public ImmutableIPAddress incr()
        Increment this IP address.
        Returns:
        the new IP address
        Throws:
        java.lang.IllegalStateException - if it overflows
      • decr

        public ImmutableIPAddress decr()
        Decrement this IP address.
        Returns:
        the new IP address
        Throws:
        java.lang.IllegalStateException - if it underflows
      • isPredecessorOf

        public boolean isPredecessorOf​(ImmutableIPAddress other)
        Check if this IP address is immediately before the provided IP address.
        Parameters:
        other - the address to check against
        Returns:
        a boolean
      • isSuccessorOf

        public boolean isSuccessorOf​(ImmutableIPAddress other)
        Check if this IP address is immediately after the provided IP address.
        Parameters:
        other - the address to check against
        Returns:
        a boolean
      • isLessThan

        public boolean isLessThan​(ImmutableIPAddress other)
        Check if this IP address is smaller than the provided IP address.
        Parameters:
        other - the address to check against
        Returns:
        a boolean
      • isLessThanOrEqualTo

        public boolean isLessThanOrEqualTo​(ImmutableIPAddress other)
        Check if this IP address is smaller or equal to the provided IP address.
        Parameters:
        other - the address to check against
        Returns:
        a boolean
      • isGreaterThan

        public boolean isGreaterThan​(ImmutableIPAddress other)
        Check if this IP address is larger than the provided IP address.
        Parameters:
        other - the address to check against
        Returns:
        a boolean
      • isGreaterThanOrEqualTo

        public boolean isGreaterThanOrEqualTo​(ImmutableIPAddress other)
        Check if this IP address is larger or equal to the provided IP address.
        Parameters:
        other - the address to check against
        Returns:
        a boolean
      • toIpAddrString

        protected java.lang.String toIpAddrString​(java.net.InetAddress addr)
      • toIpAddrString

        protected java.lang.String toIpAddrString​(byte[] addr)
      • toIpAddrBytes

        protected byte[] toIpAddrBytes​(java.lang.String dottedNotation)
      • fromBytes

        public static int fromBytes​(byte b1,
                                    byte b2,
                                    byte b3,
                                    byte b4)
        Returns the int value whose byte representation is the given 4 bytes, in big-endian order; equivalent to Ints.fromByteArray(new byte[] {b1, b2, b3, b4}).

        From: Guava.