Class CIDR6

  • All Implemented Interfaces:
    java.lang.Comparable<CIDR>

    public class CIDR6
    extends CIDR
    • Field Detail

      • addressBigInt

        private java.math.BigInteger addressBigInt
        The big integer for the base address
      • addressEndBigInt

        private final java.math.BigInteger addressEndBigInt
        The big integer for the end address
    • Constructor Detail

      • CIDR6

        protected CIDR6​(java.net.Inet6Address newaddress,
                        int newmask)
    • Method Detail

      • getEndAddress

        public java.net.InetAddress getEndAddress()
        Specified by:
        getEndAddress in class CIDR
        Returns:
        the end address of this block.
      • compareTo

        public int compareTo​(CIDR arg)
      • contains

        public boolean contains​(java.net.InetAddress inetAddress)
        Description copied from class: CIDR
        Compares the given InetAddress against the CIDR and returns true if the ip is in the subnet-ip-range and false if not.
        Specified by:
        contains in class CIDR
        Returns:
        returns true if the given IP address is inside the currently set network.
      • ipv6CidrMaskToBaseAddress

        private static java.math.BigInteger ipv6CidrMaskToBaseAddress​(int cidrMask)
        Given an IPv6 baseAddress length, return the block length. I.e., a baseAddress length of 96 will return 2**32.
      • ipv6CidrMaskToMask

        private static java.math.BigInteger ipv6CidrMaskToMask​(int cidrMask)
      • ipv6AddressToBigInteger

        private static java.math.BigInteger ipv6AddressToBigInteger​(java.net.InetAddress addr)
        Given an IPv6 address, convert it into a BigInteger.
        Returns:
        the integer representation of the InetAddress
        Throws:
        java.lang.IllegalArgumentException - if the address is not an IPv6 address.
      • bigIntToIPv6Address

        private static java.net.InetAddress bigIntToIPv6Address​(java.math.BigInteger addr)
                                                         throws java.net.UnknownHostException
        Convert a big integer into an IPv6 address.
        Returns:
        the inetAddress from the integer
        Throws:
        java.net.UnknownHostException - if the big integer is too large, and thus an invalid IPv6 address.