inet.ipaddr.ipv6

Class IPv6Address

    • Constructor Detail

      • IPv6Address

        public IPv6Address(IPv6AddressSegment[] segments,
                           java.lang.CharSequence zone)
                    throws AddressValueException
        Constructs an IPv6 address or a set of addresses.
        Parameters:
        segments - the address segments
        zone - the zone or scope id
        Throws:
        AddressValueException - if segment count is not 8 or the zone invalid
      • IPv6Address

        public IPv6Address(java.net.Inet6Address inet6Address)
        Constructs an IPv6 address.
        Parameters:
        inet6Address - the java.net address object
      • IPv6Address

        public IPv6Address(byte[] bytes,
                           java.lang.CharSequence zone)
                    throws AddressValueException
        Constructs an IPv6 address.

        The byte array can be a 16 byte IPv6 address, but may have additional zero-valued bytes, or it may be fewer than 16 bytes.

        Parameters:
        bytes - the 16 byte IPv6 address in network byte order - if longer than 16 bytes the additional bytes must be zero (and are ignored), if shorter than 16 bytes then the bytes are sign-extended to 16 bytes.
        Throws:
        AddressValueException - if bytes not equivalent to a 16 byte address
        AddressValueException - if byte range invalid or zone invalid
      • IPv6Address

        public IPv6Address(byte[] bytes)
                    throws AddressValueException
        Constructs an IPv6 address.

        The byte array can be a 16 byte IPv6 address, but may have additional zero-valued bytes, or it may be fewer than 16 bytes.

        Parameters:
        bytes - the 16 byte IPv6 address in network byte order - if longer than 16 bytes the additional bytes must be zero (and are ignored), if shorter than 16 bytes then the bytes are sign-extended to 16 bytes.
        Throws:
        AddressValueException - if bytes not equivalent to a 16 byte address
      • IPv6Address

        public IPv6Address(byte[] bytes,
                           int byteStartIndex,
                           int byteEndIndex)
                    throws AddressValueException
        Constructs an IPv6 address or subnet.

        Similar to IPv6Address(byte[]) except that you can specify the start and end of the address in the given byte array.

        Throws:
        AddressValueException - if byte range invalid
      • IPv6Address

        public IPv6Address(byte[] bytes,
                           java.lang.Integer networkPrefixLength)
                    throws AddressValueException
        Constructs an IPv6 address or subnet.

        The byte array can be a 16 byte IPv6 address, but may have additional zero-valued bytes, or it may be fewer than 16 bytes.

        When networkPrefixLength is non-null, depending on the prefix configuration (see AddressNetwork.getPrefixConfiguration(), this object may represent either a single address with that network prefix length, or the prefix subnet block containing all addresses with the same network prefix.

        Parameters:
        bytes - the 16 byte IPv6 address in network byte order - if longer than 16 bytes the additional bytes must be zero (and are ignored), if shorter than 16 bytes then the bytes are sign-extended to 16 bytes.
        networkPrefixLength - the CIDR prefix, which can be null for no prefix length
        Throws:
        AddressValueException - if bytes not equivalent to a 16 byte address
      • IPv6Address

        public IPv6Address(byte[] bytes,
                           int byteStartIndex,
                           int byteEndIndex,
                           java.lang.Integer networkPrefixLength)
                    throws AddressValueException
        Constructs an IPv6 address or subnet.

        Similar to IPv6Address(byte[], Integer) except that you can specify the start and end of the address in the given byte array.

        Throws:
        AddressValueException
      • IPv6Address

        public IPv6Address(java.math.BigInteger val)
                    throws AddressValueException
        Constructs an IPv6 address.

        The byte representation from BigInteger.toByteArray() is used, and the byte array follows the rules according to IPv6Address(byte[]). Either it must be exactly 16 bytes, or if larger then any extra bytes must be significant leading zeros, or if smaller it is sign-extended to the required 16 byte length.

        This means that you can end up with the same address from two different values of BigInteger, one positive and one negative. For instance, -1 and ffffffffffffffffffffffffffffffff are represented by the two's complement byte arrays [ff,ff,ff,ff,ff,ff,ff,ff,ff,ff,ff,ff,ff,ff,ff,ff] and [0,ff,ff,ff,ff,ff,ff,ff,ff,ff,ff,ff,ff,ff,ff,ff,ff] respectively. Both create the address ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff

        In fact, the two's complement byte array [ff,ff,ff,ff,ff,ff,ff,ff,ff,ff,ff,ff,ff,ff,ff,ff] can be shortened to [ff], the former being the sign-extension of the latter. So the byte array [ff] also creates the address ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff.

        When using positive integers you end up with the results you expect, the magnitude of the big integer becomes the address.

        When ranging over all 16-byte arrays and constructing BigInteger from those arrays, you range over all possible addresses.

        Parameters:
        val - must be an IPv6 address value.
        Throws:
        AddressValueException - if value is outside the range of potential values
        AddressValueException - if val is invalid
      • IPv6Address

        public IPv6Address(java.math.BigInteger val,
                           java.lang.Integer networkPrefixLength)
                    throws AddressValueException
        Constructs an IPv6 address.

        The byte representation from BigInteger.toByteArray() is used, and the byte array follows the rules according to IPv6Address(byte[]). Either it must be exactly 16 bytes, or if larger then any extra bytes must be significant leading zeros, or if smaller it is sign-extended to the required 16 byte length.

        When networkPrefixLength is non-null, depending on the prefix configuration (see AddressNetwork.getPrefixConfiguration(), this object may represent either a single address with that network prefix length, or the prefix subnet block containing all addresses with the same network prefix.

        Parameters:
        val -
        networkPrefixLength -
        Throws:
        AddressValueException - if val is invalid
      • IPv6Address

        public IPv6Address(java.math.BigInteger val,
                           java.lang.CharSequence zone)
                    throws AddressValueException
        Constructs an IPv6 address.

        The byte representation from BigInteger.toByteArray() is used, and the byte array follows the rules according to IPv6Address(byte[]). Either it must be exactly 16 bytes, or if larger then any extra bytes must be significant leading zeros, or if smaller it is sign-extended to the required 16 byte length.

        Parameters:
        val -
        zone -
        Throws:
        AddressValueException - if val is invalid or if zone is invalid
      • IPv6Address

        public IPv6Address(java.math.BigInteger val,
                           java.lang.Integer networkPrefixLength,
                           java.lang.CharSequence zone)
                    throws AddressValueException
        Constructs an IPv6 address or subnet.

        When networkPrefixLength is non-null, depending on the prefix configuration (see AddressNetwork.getPrefixConfiguration(), this object may represent either a single address with that network prefix length, or the prefix subnet block containing all addresses with the same network prefix.

        Parameters:
        val - must be an IPv6 address value
        networkPrefixLength - the CIDR prefix length, which can be null for no prefix length
        zone - the zone or scope id
        Throws:
        AddressValueException - if value is outside the range of potential values, or if zone is invalid
      • IPv6Address

        public IPv6Address(Address.SegmentValueProvider lowerValueProvider,
                           Address.SegmentValueProvider upperValueProvider,
                           java.lang.Integer networkPrefixLength)
                    throws AddressValueException
        Constructs an IPv6 address or subnet.

        When networkPrefixLength is non-null, depending on the prefix configuration (see AddressNetwork.getPrefixConfiguration(), this object may represent either a single address with that network prefix length, or the prefix subnet block containing all addresses with the same network prefix.

        Parameters:
        lowerValueProvider - supplies the 2 byte lower values for each segment
        upperValueProvider - supplies the 2 byte upper values for each segment
        networkPrefixLength - the CIDR network prefix length, which can be null for no prefix
        Throws:
        AddressValueException
      • IPv6Address

        public IPv6Address(Address.SegmentValueProvider lowerValueProvider,
                           Address.SegmentValueProvider upperValueProvider)
        Constructs an IPv6 address or subnet.
        Parameters:
        lowerValueProvider - supplies the 2 byte lower values for each segment
        upperValueProvider - supplies the 2 byte upper values for each segment
      • IPv6Address

        public IPv6Address(Address.SegmentValueProvider valueProvider,
                           java.lang.Integer networkPrefixLength)
                    throws AddressValueException
        Constructs an IPv6 address.

        When networkPrefixLength is non-null, depending on the prefix configuration (see AddressNetwork.getPrefixConfiguration(), this object may represent either a single address with that network prefix length, or the prefix subnet block containing all addresses with the same network prefix.

        Parameters:
        valueProvider - supplies the 2 byte value for each segment
        networkPrefixLength - the CIDR network prefix length, which can be null for no prefix
        Throws:
        AddressValueException
      • IPv6Address

        public IPv6Address(Address.SegmentValueProvider valueProvider)
        Constructs an IPv6 address.
        Parameters:
        valueProvider - supplies the 2 byte value for each segment
      • IPv6Address

        public IPv6Address(IPv6Address prefix,
                           MACAddress eui)
                    throws IncompatibleAddressException
        Constructs an IPv6 address from a modified EUI-64 (Extended Unique Identifier) address section and an IPv6 address section network prefix.

        If the supplied MAC section is an 8 byte EUI-64, then it must match the required EUI-64 format of xx-xx-ff-fe-xx-xx with the ff-fe section in the middle. If the supplied section is a 6 byte MAC-48 or EUI-48, then the ff-fe pattern will be inserted.

        If the supplied section neither 6 nor 8 bytes, or if the 8-byte section does not have required EUI-64 format of xx-xx-ff-fe-xx-xx, IncompatibleAddressException will be thrown.

        The constructor will toggle the MAC U/L (universal/local) bit as required with EUI-64.

        Only the first 8 bytes (4 segments) of the IPv6Address are used to construct the address.

        Any prefix length in the MAC address is ignored, while a prefix length in the IPv6 address is preserved but only up to the first 4 segments.

        Parameters:
        prefix - an address from which the first four segments will be used as the same initial segments in the returned address
        eui -
        Throws:
        IncompatibleAddressException - if the MACAddress is an 8 byte MAC address incompatible with EUI-64 IPv6 format
      • IPv6Address

        public IPv6Address(IPv6AddressSection section,
                           MACAddress eui)
                    throws IncompatibleAddressException,
                           AddressValueException
        Constructs an IPv6 address from a modified EUI-64 (Extended Unique Identifier) address section and an IPv6 address section network prefix.

        If the supplied MAC section is an 8 byte EUI-64, then it must match the required EUI-64 format of xx-xx-ff-fe-xx-xx with the ff-fe section in the middle. If the supplied section is a 6 byte MAC-48 or EUI-48, then the ff-fe pattern will be inserted.

        If the supplied section neither 6 nor 8 bytes, or if the 8-byte section does not have required EUI-64 format of xx-xx-ff-fe-xx-xx, IncompatibleAddressException will be thrown.

        The constructor will toggle the MAC U/L (universal/local) bit as required with EUI-64.

        The IPv6 address section must be 8 bytes.

        Any prefix length in the MAC address is ignored, while a prefix length in the IPv6 address is preserved but only up to the first 4 segments.

        Parameters:
        section -
        eui -
        Throws:
        IncompatibleAddressException - if the MACAddress is an 8 byte MAC address incompatible with EUI-64 IPv6 format
        AddressValueException - if the IPv6 section is the wrong size or structure
      • IPv6Address

        public IPv6Address(IPv6AddressSection section,
                           MACAddressSection eui)
                    throws IncompatibleAddressException,
                           AddressValueException
        Constructs an IPv6 address from a modified EUI-64 (Extended Unique Identifier) address and an IPv6 address section network prefix.

        If the supplied address is an 8 byte EUI-64, then it must match the required EUI-64 format of xx-xx-ff-fe-xx-xx with the ff-fe section in the middle. If the supplied address is a 6 byte MAC-48 or EUI-48, then the ff-fe pattern will be inserted.

        The constructor will toggle the MAC U/L (universal/local) bit as required with EUI-64.

        The IPv6 address section must be 8 bytes.

        Any prefix length in the MAC address is ignored, while a prefix length in the IPv6 address is preserved but only up to the first 4 segments.

        Parameters:
        section -
        eui -
        Throws:
        IncompatibleAddressException - if the MACAddress is an 8 byte MAC address incompatible with EUI-64 IPv6 format
        AddressValueException - if the MACAddress or IPv6 sections are the wrong size or structure