Skip to content

Version 4.0.0

Compare
Choose a tag to compare
@seancfoley seancfoley released this 10 Dec 03:06
· 394 commits to master since this release

The main change in version 4 is a change to the way IP addresses with prefix length are handled. The old behaviour remains supported, see the doc section on prefix length handling to switch back (as simple as assigning a static field). The new behaviour is to recognize addresses with a zero host as the prefix-block subnet, while addresses with non-zero hosts are now considered individual addresses with an associated prefix length. This is consistent with common usage conventions for IPv4 and IPv6.

  • added the new prefix behaviour and prefix length handling options
  • changes to network classes and address classes to support the new prefix handling options
  • runtime exception refactoring (AddressTypeException is now AddressValueException, other new exceptions added) and added more error checking
  • added new method options to ignore IPv4 network address or IPv6 anycast address (ie the zero-host address) when iterating or getting the lowest address in a subnet
  • added new conversions to/from BigInteger, int, long
  • added intersect method
  • added toPrefixBlock method (gives prefix block for any individual address with prefix length)
  • added IPAddressSegmentSeries interface for a shared interface amongst IP addresses and address sections
  • renamed a bunch of methods (consistent with the new prefix length handling):
    isRangeEquivalentToPrefix renamed to isSinglePrefixBlock
    getEquivalentPrefix renamed to getPrefixLengthForSingleBlock
    toPrefixedEquivalent renamed to assignPrefixForSingleBlock
    isRangeUnchanged renamed to isPrefixBlock(Integer)
    getMinPrefix renamed to getMinPrefixLengthForBlock
    toMinPrefixedEquivalent renamed to assignMinPrefixForBlock
    getMaskPrefixLength renamed to getBlockMaskPrefixLength
    matchesWithPrefix renamed to matchesWithPrefixMask
    isRangeEquivalent renamed to isPrefixBlock
    isMultipleByNetworkPrefix is replaced by isSinglePrefixBlock
  • moved a few static methods:
    IPAddress.getStandardLoopbackStrings, IPAddress.getLoopback available from class IPAddressNetwork
    IPAddress.from available as IPAddressNetwork.IPAddressGenerator.from
    IPAddress.getLocalHost is removed. Instead use IPAddressNetwork.IPAddressGenerator.from on the result of InetAddress.getLocalHost().getAddress()
  • Some network object access methods have been changed. You can address default network object directly from defaultIpv4Network, defaultIpv6Network and defaultMACNetwork in class Address.

Version 4 is not backwards compatible with version 3, but migration is straightforward. Most of the API has not changed.