/** * Create an IPv6 network from an IPv6Address and an IPv6NetworkMask * * @param address IPv6 address (the network address or any other address within the network) * @param networkMask IPv6 network mask * @return IPv6 network */ public static IPv6Network fromAddressAndMask(IPv6Address address, IPv6NetworkMask networkMask) { return new IPv6Network(address, networkMask); }
/** * Create an IPv6 network from an IPv6Address and an IPv6NetworkMask * * @param address IPv6 address (the network address or any other address within the network) * @param networkMask IPv6 network mask * @return IPv6 network */ public static IPv6Network fromAddressAndMask(IPv6Address address, IPv6NetworkMask networkMask) { return new IPv6Network(address, networkMask); }
/** * Create an IPv6 network from the two addresses within the network. This will construct the smallest possible network ("longest prefix * length") which contains both addresses. * * @param one address one * @param two address two, should be bigger than address one * @return ipv6 network */ public static IPv6Network fromTwoAddresses(IPv6Address one, IPv6Address two) { final IPv6NetworkMask longestPrefixLength = IPv6NetworkMask.fromPrefixLength(IPv6NetworkHelpers.longestPrefixLength(one, two)); return new IPv6Network(one.maskWithNetworkMask(longestPrefixLength), longestPrefixLength); }
/** * Create an IPv6 network from the two addresses within the network. This will construct the smallest possible network ("longest prefix * length") which contains both addresses. * * @param one address one * @param two address two, should be bigger than address one * @return ipv6 network */ public static IPv6Network fromTwoAddresses(IPv6Address one, IPv6Address two) { final IPv6NetworkMask longestPrefixLength = IPv6NetworkMask.fromPrefixLength(IPv6NetworkHelpers.longestPrefixLength(one, two)); return new IPv6Network(one.maskWithNetworkMask(longestPrefixLength), longestPrefixLength); }