public class IPv4AddressSeqRange extends IPAddressSeqRange implements Iterable<IPv4Address>
IPAddressSeqRange for more details.DEFAULT_RANGE_SEPARATOR| Constructor and Description |
|---|
IPv4AddressSeqRange(IPv4Address first,
IPv4Address second) |
| Modifier and Type | Method and Description |
|---|---|
IPv4Address |
coverWithPrefixBlock()
Returns the minimal-size prefix block that covers all the addresses in this range.
|
long |
getIPv4Count()
Equivalent to
IPAddressSeqRange.getCount() but returns a long |
long |
getIPv4PrefixCount(int prefixLength)
Equivalent to
getPrefixCount(int) but returns a long |
Iterable<IPv4Address> |
getIterable()
Useful for using an instance in a "for-each loop", as in
for(addr : address.getIterable()) { ... |
IPv4Address |
getLower()
Returns the lowest address in the sequential range, the one with the lowest numeric value
|
int |
getMinPrefixLengthForBlock()
Returns the smallest prefix length possible such that this item includes the block of all values for that prefix length.
|
BigInteger |
getPrefixCount(int prefixLength)
The count of the number of distinct values within the prefix part of the address item, the bits that appear within the prefix length.
|
Integer |
getPrefixLengthForSingleBlock()
Returns a prefix length for which the range of this item matches the block of all values for that prefix length.
|
IPv4Address |
getUpper()
Returns the highest address in the sequential range, the one with the highest numeric value
|
IPv4AddressSeqRange |
intersect(IPAddressSeqRange other)
Returns the intersection of this range with the given range, a range which includes those addresses in both this and the given range.
|
Iterator<IPv4Address> |
iterator()
Iterates through the individual addresses of this address or subnet.
|
IPv4AddressSeqRange |
join(IPAddressSeqRange other)
Joins two ranges if they are contiguous ranges.
|
Iterator<IPv4Address> |
prefixBlockIterator(int prefLength)
Iterates through the range of prefix blocks in this range instance using the given prefix length.
|
AddressComponentRangeSpliterator<IPv4AddressSeqRange,IPv4Address> |
prefixBlockSpliterator(int prefLength)
Partitions and traverses through the individual prefix blocks for the given prefix length.
|
Stream<IPv4Address> |
prefixBlockStream(int prefLength)
Returns a sequential stream of the prefix blocks for the given prefix length.
|
Iterator<IPv4AddressSeqRange> |
prefixIterator(int prefixLength)
Iterates through the range of prefixes in this range instance using the given prefix length.
|
AddressComponentSpliterator<IPv4AddressSeqRange> |
prefixSpliterator(int prefLength)
Partitions and traverses through the individual prefixes for the given prefix length.
|
Stream<IPv4AddressSeqRange> |
prefixStream(int prefLength)
Returns a sequential stream of the individual prefixes for the given prefix length.
|
IPv4Address[] |
spanWithPrefixBlocks()
Produces an array of prefix blocks that spans the same set of addresses.
|
IPv4Address[] |
spanWithSequentialBlocks()
Produces an array of blocks that are sequential that cover the same set of addresses.
|
AddressComponentRangeSpliterator<IPv4AddressSeqRange,IPv4Address> |
spliterator()
Partitions and traverses through the individual addresses.
|
Stream<IPv4Address> |
stream()
Returns a sequential stream of the individual address components.
|
IPv4AddressSeqRange[] |
subtract(IPAddressSeqRange other)
Subtracts the given range from this range, to produce either zero, one, or two address ranges that contain the addresses in this range and not in the given range.
|
String |
toIPv4String(Function<IPv4Address,String> lowerStringer,
String separator,
Function<IPv4Address,String> upperStringer) |
IPv4AddressSeqRange |
toSequentialRange()
Converts to a sequential range from the lowest and highest addresses in this range, returns "this" if one already
|
contains, contains, containsPrefixBlock, containsSinglePrefixBlock, enumerate, equals, extend, getBitCount, getBytes, getBytes, getBytes, getCount, getUpperBytes, getUpperBytes, getUpperBytes, getUpperValue, getValue, hashCode, includesMax, includesZero, isMax, isMore, isMultiple, isSequential, isZero, join, overlaps, overlaps, toCanonicalString, toCanonicalString, toNormalizedString, toNormalizedString, toString, toStringstream, streamcompareTo, getBitsForCount, getBlockSize, getByteCount, isFullRangepublic IPv4AddressSeqRange(IPv4Address first, IPv4Address second)
public IPv4Address getLower()
IPAddressSeqRangegetLower in interface AddressComponentRangegetLower in interface IPAddressRangegetLower in class IPAddressSeqRangepublic IPv4Address getUpper()
IPAddressSeqRangegetUpper in interface AddressComponentRangegetUpper in interface IPAddressRangegetUpper in class IPAddressSeqRangepublic long getIPv4Count()
IPAddressSeqRange.getCount() but returns a longpublic long getIPv4PrefixCount(int prefixLength)
getPrefixCount(int) but returns a longpublic BigInteger getPrefixCount(int prefixLength)
AddressItemgetPrefixCount in interface AddressItempublic Iterable<IPv4Address> getIterable()
IPAddressRangefor(addr : address.getIterable()) { ... }
Otherwise just call IPAddressRange.iterator() directly.
getIterable in interface AddressComponentRangegetIterable in interface IPAddressRangegetIterable in class IPAddressSeqRangepublic Iterator<IPv4Address> iterator()
IPAddressRange
Call AddressItem.isMultiple() to determine if this instance represents multiple, or AddressItem.getCount() for the count.
iterator in interface AddressComponentRangeiterator in interface IPAddressRangeiterator in interface Iterable<IPv4Address>iterator in class IPAddressSeqRangepublic AddressComponentRangeSpliterator<IPv4AddressSeqRange,IPv4Address> spliterator()
IPAddressRangespliterator in interface AddressComponentRangespliterator in interface IPAddressRangespliterator in interface Iterable<IPv4Address>spliterator in class IPAddressSeqRangepublic Stream<IPv4Address> stream()
AddressComponentRangeBaseStream.parallel() on the returned stream.stream in interface AddressComponentRangestream in class IPAddressSeqRangepublic Iterator<IPv4Address> prefixBlockIterator(int prefLength)
IPAddressSeqRangeprefixBlockIterator in interface IPAddressRangeprefixBlockIterator in class IPAddressSeqRangepublic AddressComponentRangeSpliterator<IPv4AddressSeqRange,IPv4Address> prefixBlockSpliterator(int prefLength)
IPAddressRangeprefixBlockSpliterator in interface IPAddressRangeprefixBlockSpliterator in class IPAddressSeqRangepublic Stream<IPv4Address> prefixBlockStream(int prefLength)
IPAddressRangeBaseStream.parallel() on the returned stream.prefixBlockStream in interface IPAddressRangeprefixBlockStream in class IPAddressSeqRangepublic Iterator<IPv4AddressSeqRange> prefixIterator(int prefixLength)
IPAddressSeqRange
Since a range between two arbitrary addresses cannot always be represented with a single IPAddress instance,
the returned iterator iterates through IPAddressSeqRange instances.
For instance, if iterating from 1.2.3.4 to 1.2.4.5 with prefix 8, the range shares the same prefix 1, but the range cannot be represented by the address 1.2.3-4.4-5 which does not include 1.2.3.255 or 1.2.4.0 both of which are in the original range. Nor can the range be represented by 1.2.3-4.0-255 which includes 1.2.4.6 and 1.2.3.3, both of which were not in the original range. An IPAddressSeqRange is thus required to represent that prefixed range.
prefixIterator in interface IPAddressRangeprefixIterator in class IPAddressSeqRangepublic Stream<IPv4AddressSeqRange> prefixStream(int prefLength)
IPAddressRangeBaseStream.parallel() on the returned stream.prefixStream in interface IPAddressRangeprefixStream in class IPAddressSeqRangepublic AddressComponentSpliterator<IPv4AddressSeqRange> prefixSpliterator(int prefLength)
IPAddressRangeprefixSpliterator in interface IPAddressRangeprefixSpliterator in class IPAddressSeqRangepublic IPv4Address coverWithPrefixBlock()
IPAddressSeqRangecoverWithPrefixBlock in interface IPAddressRangecoverWithPrefixBlock in class IPAddressSeqRangepublic IPv4Address[] spanWithPrefixBlocks()
IPAddressRangespanWithPrefixBlocks in interface IPAddressRangespanWithPrefixBlocks in class IPAddressSeqRangepublic IPv4Address[] spanWithSequentialBlocks()
IPAddressRangeIPAddressRange.spanWithPrefixBlocks() and is never longer.spanWithSequentialBlocks in interface IPAddressRangespanWithSequentialBlocks in class IPAddressSeqRangepublic int getMinPrefixLengthForBlock()
AddressItem
If the entire range can be dictated this way, then this method returns the same value as AddressItem.getPrefixLengthForSingleBlock().
Otherwise, this method will return the minimal possible prefix that can be paired with this address, while AddressItem.getPrefixLengthForSingleBlock() will return null.
In cases where the final bit is constant so there is no such block, this returns the bit count.
getMinPrefixLengthForBlock in interface AddressItempublic Integer getPrefixLengthForSingleBlock()
AddressItem
If the range can be dictated this way, then this method returns the same value as AddressItem.getMinPrefixLengthForBlock().
If no such prefix length exists, returns null.
If this item represents a single value, this returns the bit count.
getPrefixLengthForSingleBlock in interface AddressItempublic String toIPv4String(Function<IPv4Address,String> lowerStringer, String separator, Function<IPv4Address,String> upperStringer)
public IPv4AddressSeqRange intersect(IPAddressSeqRange other)
IPAddressSeqRangeintersect in class IPAddressSeqRangepublic IPv4AddressSeqRange join(IPAddressSeqRange other)
IPAddressSeqRangeOtherwise, null is returned.
join in class IPAddressSeqRangepublic IPv4AddressSeqRange[] subtract(IPAddressSeqRange other)
IPAddressSeqRangesubtract in class IPAddressSeqRangepublic IPv4AddressSeqRange toSequentialRange()
IPAddressRange
The result will represent the same set of addresses if and only if IPAddressRange.isSequential() is true
toSequentialRange in interface IPAddressRange