public abstract class IPAddressSeqRange extends java.lang.Object implements IPAddressRange
Note that the IPAddress and IPAddressString classes allow you to specify a range of values for each segment.
That allows you to represent single addresses, any address prefix subnet (eg 1.2.0.0/16 or 1:2:3:4::/64) or any subnet that can be represented with segment ranges (1.2.0-255.* or 1:2:3:4:*), see
IPAddressString for details.
IPAddressString and IPAddress cover all potential subnets and addresses that can be represented by a single address string of 4 or less segments for IPv4, and 8 or less segments for IPv6.
This class allows the representation of any sequential address range, including those that cannot be represented by IPAddress.
String representations include the full address for both the lower and upper bounds of the range.
| Modifier and Type | Method and Description |
|---|---|
boolean |
contains(IPAddress other)
Returns whether this range contains all addresses in the given address or subnet
|
boolean |
contains(IPAddressSeqRange other)
Returns whether this range contains all addresses in the given sequential range
|
boolean |
containsPrefixBlock(int prefixLen)
Returns whether the values of this series contains the prefix block for the given prefix length.
|
boolean |
containsSinglePrefixBlock(int prefixLen)
Returns whether the values of this series contains a single prefix block for the given prefix length.
|
boolean |
equals(java.lang.Object o) |
int |
getBitCount() |
byte[] |
getBytes() |
byte[] |
getBytes(byte[] bytes)
Copies the bytes of the smallest address item represented by this address item into the supplied array,
and returns that array.
|
byte[] |
getBytes(byte[] bytes,
int index)
Copies the bytes of the smallest address item represented by this address item into the supplied array starting at the given index,
and returns that array.
|
java.math.BigInteger |
getCount()
The count of possible distinct values for this AddressComponent.
|
abstract java.lang.Iterable<? extends IPAddress> |
getIterable()
Useful for using an instance in a "for-each loop", as in
for(addr : address.getIterable()) { ... |
IPAddress |
getLower()
If this instance represents multiple individual addresses, returns the one with the lowest numeric value.
|
IPAddress |
getUpper()
If this instance represents multiple individual addresses, returns the one with the highest numeric value.
|
byte[] |
getUpperBytes() |
byte[] |
getUpperBytes(byte[] bytes)
Copies the bytes of the largest address item represented by this address item into the supplied array,
and returns that array.
|
byte[] |
getUpperBytes(byte[] bytes,
int index)
Copies the bytes of the largest address item represented by this address item into the supplied array at the given index,
and returns that array.
|
java.math.BigInteger |
getUpperValue() |
java.math.BigInteger |
getValue() |
int |
hashCode() |
boolean |
includesMax() |
boolean |
includesZero() |
IPAddressSeqRange |
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 rqnge.
|
boolean |
isMax() |
boolean |
isMore(IPAddressSeqRange other) |
boolean |
isMultiple()
Whether this represents multiple potential values (eg a prefixed address or a segment representing a range of values)
|
boolean |
isZero() |
abstract java.util.Iterator<? extends IPAddress> |
iterator()
Iterates through the individual addresses of this address or subnet.
|
static IPAddressSeqRange[] |
join(IPAddressSeqRange... ranges)
Joins the given ranges into the fewest number of ranges.
|
IPAddressSeqRange |
join(IPAddressSeqRange other)
If this range overlaps with the given range,
or if the highest value of the lower range is one below the lowest value of the higher range,
then the two are joined into a new larger range that is returned.
|
boolean |
overlaps(IPAddressSeqRange other) |
abstract java.util.Iterator<? extends IPAddress> |
prefixBlockIterator(int prefLength)
Iterates through the range of prefix blocks in this range instance using the given prefix length.
|
java.util.Iterator<? extends IPAddressSeqRange> |
prefixIterator(int prefixLength)
Iterates through the range of prefixes in this range instance using the given prefix length.
|
abstract IPAddress[] |
spanWithPrefixBlocks()
Produces an array of prefix blocks that cover the same set of addresses.
|
abstract IPAddress[] |
spanWithSequentialBlocks()
Produces an array of blocks that are sequential that cover the same set of addresses.
|
IPAddressSeqRange[] |
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.
|
java.lang.String |
toCanonicalString()
Produces a string that is unique and uses the canonical representation for all instances.
|
java.lang.String |
toCanonicalString(java.lang.String separator) |
java.lang.String |
toNormalizedString()
Produces a string that is unique and consistent for all instances.
|
java.lang.String |
toNormalizedString(java.lang.String separator) |
java.lang.String |
toString() |
java.lang.String |
toString(java.util.function.Function<IPAddress,java.lang.String> lowerStringer,
java.lang.String separator,
java.util.function.Function<IPAddress,java.lang.String> upperStringer) |
compareTo, getByteCount, getMinPrefixLengthForBlock, getPrefixCount, getPrefixLengthForSingleBlock, isFullRange, testRange, testRangepublic java.math.BigInteger getCount()
AddressItemgetCount in interface AddressItempublic boolean isMultiple()
AddressItemisMultiple in interface AddressItempublic boolean isMore(IPAddressSeqRange other)
other - the range to compare, which does not need to range across the same address spacepublic abstract java.lang.Iterable<? extends IPAddress> getIterable()
IPAddressRangefor(addr : address.getIterable()) { ... }
Otherwise just call IPAddressRange.iterator() directly.
getIterable in interface AddressItemRangegetIterable in interface IPAddressRangepublic abstract java.util.Iterator<? extends IPAddress> prefixBlockIterator(int prefLength)
prefixBlockIterator in interface IPAddressRangeprefLength - public java.util.Iterator<? extends IPAddressSeqRange> prefixIterator(int prefixLength)
prefixIterator in interface IPAddressRangeprefixLength - public abstract java.util.Iterator<? extends IPAddress> iterator()
IPAddressRange
Call AddressItem.isMultiple() to determine if this instance represents multiple, or AddressItem.getCount() for the count.
iterator in interface AddressItemRangeiterator in interface IPAddressRangepublic IPAddress getLower()
IPAddressRangegetLower in interface AddressItemRangegetLower in interface IPAddressRangepublic IPAddress getUpper()
IPAddressRangegetUpper in interface AddressItemRangegetUpper in interface IPAddressRangepublic java.lang.String toNormalizedString(java.lang.String separator)
public java.lang.String toNormalizedString()
IPAddressRangetoNormalizedString in interface IPAddressRangepublic java.lang.String toCanonicalString(java.lang.String separator)
public java.lang.String toCanonicalString()
IPAddressRangetoCanonicalString in interface IPAddressRangepublic java.lang.String toString(java.util.function.Function<IPAddress,java.lang.String> lowerStringer, java.lang.String separator, java.util.function.Function<IPAddress,java.lang.String> upperStringer)
public java.lang.String toString()
toString in class java.lang.Objectpublic abstract IPAddress[] spanWithPrefixBlocks()
IPAddressRangespanWithPrefixBlocks in interface IPAddressRangepublic abstract IPAddress[] spanWithSequentialBlocks()
IPAddressRangeIPAddressRange.spanWithPrefixBlocks() and is never longer.spanWithSequentialBlocks in interface IPAddressRangepublic static IPAddressSeqRange[] join(IPAddressSeqRange... ranges)
ranges - public boolean overlaps(IPAddressSeqRange other)
public boolean contains(IPAddress other)
IPAddressRangecontains in interface IPAddressRangepublic boolean contains(IPAddressSeqRange other)
IPAddressRangecontains in interface IPAddressRangepublic int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic IPAddressSeqRange intersect(IPAddressSeqRange other)
other - public IPAddressSeqRange join(IPAddressSeqRange other)
Otherwise null is returned.
other - public IPAddressSeqRange[] subtract(IPAddressSeqRange other)
other - public boolean containsPrefixBlock(int prefixLen)
AddressItem
Use AddressItem.getMinPrefixLengthForBlock() to determine the smallest prefix length for which this method returns true.
containsPrefixBlock in interface AddressItempublic boolean containsSinglePrefixBlock(int prefixLen)
AddressItem
Use AddressItem.getPrefixLengthForSingleBlock() to determine whether there is a prefix length for which this method returns true.
containsSinglePrefixBlock in interface AddressItempublic int getBitCount()
getBitCount in interface AddressItempublic byte[] getBytes()
getBytes in interface AddressItempublic byte[] getBytes(byte[] bytes)
AddressItemgetBytes in interface AddressItempublic byte[] getBytes(byte[] bytes,
int index)
AddressItemgetBytes in interface AddressItempublic byte[] getUpperBytes()
getUpperBytes in interface AddressItempublic byte[] getUpperBytes(byte[] bytes)
AddressItemgetUpperBytes in interface AddressItempublic byte[] getUpperBytes(byte[] bytes,
int index)
AddressItemgetUpperBytes in interface AddressItempublic java.math.BigInteger getValue()
getValue in interface AddressItempublic java.math.BigInteger getUpperValue()
getUpperValue in interface AddressItempublic boolean isZero()
isZero in interface AddressItempublic boolean includesZero()
includesZero in interface AddressItempublic boolean isMax()
isMax in interface AddressItempublic boolean includesMax()
includesMax in interface AddressItem