Java Code Examples for inet.ipaddr.IPAddress#toSequentialRange()

The following examples show how to use inet.ipaddr.IPAddress#toSequentialRange() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: IPAddressProvider.java    From IPAddress with Apache License 2.0 5 votes vote down vote up
default IPAddressSeqRange getProviderSeqRange() {
	IPAddress addr = getProviderAddress();
	if(addr != null) {
		return addr.toSequentialRange();
	}
	return null;
}
 
Example 2
Source File: IPAddressProvider.java    From IPAddress with Apache License 2.0 5 votes vote down vote up
@Override
public IPAddressSeqRange getProviderSeqRange() {
	if(isProvidingAllAddresses()) {
		return null;
	}
	IPAddress mask = getProviderMask();
	if(mask != null && mask.getBlockMaskPrefixLength(true) == null) {
		// we must apply the mask
		IPAddress all = ParsedIPAddress.createAllAddress(adjustedVersion, ParsedHost.NO_QUALIFIER, null, options);
		IPAddress upper = all.getUpper().mask(mask);
		IPAddress lower = all.getLower();
		return lower.toSequentialRange(upper);
	}
	return super.getProviderSeqRange();
}