Package uk.ipfreely.sets
Interface Block<A extends Addr<A>>
- 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 Addr
es.
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:
24
bits. - Size of block: 256 addresses.
See AddressSet
for implementation contract.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiondefault String
The block in CIDR notation like192.168.100.0/24
.default boolean
isEmpty()
Block is never empty.default A
mask()
The CIDR mask as an IP address.default int
maskSize()
Mask size in bits as defined by CIDR notation.default BigInteger
size()
Number ofAddr
es in block.subnets
(int size) Divides the block into smaller subnets of given bit mask size.Methods inherited from interface uk.ipfreely.sets.AddressSet
equals, hashCode
Methods inherited from interface uk.ipfreely.sets.Range
adjacent, blocks, combine, contains, contiguous, 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/16
this returns16
.- Returns:
- mask size in bits
-
mask
The CIDR mask as an IP address. For172.26.0.0/16
this returns255.255.0.0
.first OR mask == first last AND mask == first first OR (NOT mask) == last
- Returns:
- the mask IP
-
size
Number ofAddr
es 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
-