- All Superinterfaces:
AddressComponentRange
,AddressItem
,AddressItemRange
,Comparable<AddressItem>
,Serializable
- All Known Implementing Classes:
IPAddress
,IPAddressSeqRange
,IPv4Address
,IPv4AddressSeqRange
,IPv6Address
,IPv6AddressSeqRange
Represents a range of IP addresses
- Author:
- seancfoley
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Returns whether this range contains all addresses in the given address or subnetboolean
contains
(IPAddressSeqRange other) Returns whether this range contains all addresses in the given sequential rangeReturns the minimal-size prefix block that covers all the addresses in this range.Useful for using an instance in a "for-each loop", as infor(addr : address.getIterable()) { ...
getLower()
Returns the address in the range with the lowest numeric value.getUpper()
Returns the address in the range with the highest numeric value.boolean
Returns whether this range represents a range of values that are sequential.iterator()
Iterates through the individual addresses of this address or subnet.prefixBlockIterator
(int prefLength) Iterates through the range of prefix blocks in this range instance using the given prefix length.AddressComponentRangeSpliterator
<? extends IPAddressRange, ? extends IPAddress> prefixBlockSpliterator
(int prefLength) Partitions and traverses through the individual prefix blocks for the given prefix length.prefixBlockStream
(int prefLength) Returns a sequential stream of the prefix blocks for the given prefix length.Iterator
<? extends IPAddressRange> prefixIterator
(int prefixLength) Iterates through the range of prefixes in this range instance using the given prefix length.AddressComponentSpliterator
<? extends IPAddressRange> prefixSpliterator
(int prefLength) Partitions and traverses through the individual prefixes for the given prefix length.Stream
<? extends IPAddressRange> prefixStream
(int prefLength) Returns a sequential stream of the individual prefixes for the given prefix length.Produces an array of prefix blocks that spans the same set of addresses.Produces an array of blocks that are sequential that cover the same set of addresses.AddressComponentRangeSpliterator
<? extends IPAddressRange, ? extends IPAddress> Partitions and traverses through the individual addresses.Produces a string that is unique and uses the canonical representation for all instances.Produces a string that is unique and consistent for all instances.Converts to a sequential range from the lowest and highest addresses in this range, returns "this" if one alreadyMethods inherited from interface inet.ipaddr.format.AddressComponentRange
stream
Methods inherited from interface inet.ipaddr.format.AddressItem
compareTo, containsPrefixBlock, containsSinglePrefixBlock, getBitCount, getByteCount, getBytes, getBytes, getBytes, getCount, getMinPrefixLengthForBlock, getPrefixCount, getPrefixLengthForSingleBlock, getUpperBytes, getUpperBytes, getUpperBytes, getUpperValue, getValue, includesMax, includesZero, isFullRange, isMax, isMultiple, isZero
-
Method Details
-
contains
Returns whether this range contains all addresses in the given sequential range- Parameters:
other
-- Returns:
-
contains
Returns whether this range contains all addresses in the given address or subnet- Parameters:
other
-- Returns:
-
getLower
IPAddress getLower()Returns the address in the range with the lowest numeric value.- Specified by:
getLower
in interfaceAddressComponentRange
- Returns:
-
getUpper
IPAddress getUpper()Returns the address in the range with the highest numeric value.- Specified by:
getUpper
in interfaceAddressComponentRange
- Returns:
-
getIterable
Useful for using an instance in a "for-each loop", as infor(addr : address.getIterable()) { ... }
Otherwise just call
iterator()
directly.- Specified by:
getIterable
in interfaceAddressComponentRange
- Returns:
-
iterator
Iterates through the individual addresses of this address or subnet.Call
AddressItem.isMultiple()
to determine if this instance represents multiple, orAddressItem.getCount()
for the count.- Specified by:
iterator
in interfaceAddressComponentRange
- Returns:
-
spliterator
AddressComponentRangeSpliterator<? extends IPAddressRange,? extends IPAddress> spliterator()Partitions and traverses through the individual addresses.- Specified by:
spliterator
in interfaceAddressComponentRange
- Returns:
-
prefixBlockIterator
Iterates through the range of prefix blocks in this range instance using the given prefix length.- Parameters:
prefLength
-- Returns:
-
prefixBlockSpliterator
AddressComponentRangeSpliterator<? extends IPAddressRange,? extends IPAddress> prefixBlockSpliterator(int prefLength) Partitions and traverses through the individual prefix blocks for the given prefix length.- Returns:
-
prefixBlockStream
Returns a sequential stream of the prefix blocks for the given prefix length. For a parallel stream, callBaseStream.parallel()
on the returned stream.- Returns:
-
prefixIterator
Iterates through the range of prefixes in this range instance using the given prefix length.- Parameters:
prefixLength
-- Returns:
-
prefixSpliterator
Partitions and traverses through the individual prefixes for the given prefix length.- Returns:
-
prefixStream
Returns a sequential stream of the individual prefixes for the given prefix length. For a parallel stream, callBaseStream.parallel()
on the returned stream.- Returns:
-
coverWithPrefixBlock
IPAddress coverWithPrefixBlock()Returns the minimal-size prefix block that covers all the addresses in this range. The resulting block will have a larger address count than this range, unless this range is already a prefix block. -
spanWithPrefixBlocks
IPAddress[] spanWithPrefixBlocks()Produces an array of prefix blocks that spans the same set of addresses. -
spanWithSequentialBlocks
IPAddress[] spanWithSequentialBlocks()Produces an array of blocks that are sequential that cover the same set of addresses. This array can be shorter than that produced byspanWithPrefixBlocks()
and is never longer. -
isSequential
boolean isSequential()Returns whether this range represents a range of values that are sequential.- Returns:
-
toSequentialRange
IPAddressSeqRange toSequentialRange()Converts to a sequential range from the lowest and highest addresses in this range, returns "this" if one alreadyThe result will represent the same set of addresses if and only if
isSequential()
is true -
toNormalizedString
String toNormalizedString()Produces a string that is unique and consistent for all instances.- Returns:
-
toCanonicalString
String toCanonicalString()Produces a string that is unique and uses the canonical representation for all instances.- Returns:
-