- Type Parameters:
A- the type for the IP version
- All Superinterfaces:
AddressSet<A>,Iterable<A>,Range<A>
Range interface that forms
RFC-4632 Classless Inter-domain Routing block of
IP Addresses.
Example: "192.168.0.0/24".
- First address:
192.168.0.0. - Last address:
192.168.0.255. - Network mask:
255.255.255.0. - Mask size:
24bits. - Size of block: 256 addresses.
See AddressSet for implementation contract.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiondefault StringThe block in CIDR notation like192.168.100.0/24.default booleanisEmpty()Block is never empty.default Amask()The CIDR mask as an IP address.default intmaskSize()Mask size in bits as defined by CIDR notation.default BigIntegersize()Number ofAddresses in block.subnets(int size) Divides the block into smaller subnets of given bit mask size.Methods inherited from interface uk.ipfreely.sets.AddressSet
addresses, equals, hashCodeMethods inherited from interface uk.ipfreely.sets.Range
adjacent, blocks, contains, contiguous, extremes, family, first, intersects, iterator, last, ranges, spliterator, stream
-
Method Details
-
cidrNotation
The block in CIDR notation like192.168.100.0/24.- Returns:
- canonical form that can be parsed
- See Also:
-
maskSize
default int maskSize()Mask size in bits as defined by CIDR notation. For172.26.0.0/16this returns16.- Returns:
- mask size in bits
-
mask
The CIDR mask as an IP address. For172.26.0.0/16this returns255.255.0.0.first OR mask == first last AND mask == first first OR (NOT mask) == last- Returns:
- the mask IP
-
size
Number ofAddresses in block. -
isEmpty
default boolean isEmpty()Block is never empty. -
subnets
Divides the block into smaller subnets of given bit mask size.- Parameters:
size- betweenmaskSize()andFamily.width()inclusive- Returns:
- stream of subnet blocks
-