public class IPv6AddressSection extends IPAddressSection implements java.lang.Iterable<IPv6AddressSection>
Modifier and Type | Class and Description |
---|---|
static class |
IPv6AddressSection.CompressOptions |
static class |
IPv6AddressSection.IPv6StringBuilderOptions |
static class |
IPv6AddressSection.IPv6StringOptions
Provides a clear way to create a specific type of string.
|
static class |
IPv6AddressSection.IPv6v4MixedAddressSection |
IPAddressSection.IPStringBuilderOptions, IPAddressSection.IPStringOptions, IPAddressSection.SegFunction<R,S>, IPAddressSection.WildcardOptions
IPAddressDivisionGrouping.Range, IPAddressDivisionGrouping.RangeList
AddressDivisionGrouping.StringOptions
Modifier and Type | Field and Description |
---|---|
int |
addressSegmentIndex |
Constructor and Description |
---|
IPv6AddressSection(Address.SegmentValueProvider lowerValueProvider,
Address.SegmentValueProvider upperValueProvider,
int segmentCount) |
IPv6AddressSection(Address.SegmentValueProvider lowerValueProvider,
Address.SegmentValueProvider upperValueProvider,
int segmentCount,
java.lang.Integer networkPrefixLength) |
IPv6AddressSection(Address.SegmentValueProvider valueProvider,
int segmentCount) |
IPv6AddressSection(Address.SegmentValueProvider valueProvider,
int segmentCount,
java.lang.Integer networkPrefixLength) |
IPv6AddressSection(java.math.BigInteger val,
int segmentCount) |
IPv6AddressSection(java.math.BigInteger val,
int segmentCount,
java.lang.Integer networkPrefixLength) |
IPv6AddressSection(byte[] bytes) |
IPv6AddressSection(byte[] bytes,
java.lang.Integer prefix) |
IPv6AddressSection(byte[] bytes,
int byteStartIndex,
int byteEndIndex) |
IPv6AddressSection(byte[] bytes,
int byteStartIndex,
int byteEndIndex,
java.lang.Integer prefix) |
IPv6AddressSection(IPv6AddressSegment segment)
Constructs a single segment section, the segment being the leading segment.
|
IPv6AddressSection(IPv6AddressSegment[] segments)
Use this constructor for any address section that includes the leading segment of an IPv6 address
|
IPv6AddressSection(IPv6AddressSegment[] segments,
java.lang.Integer networkPrefixLength)
Use this constructor for any address section that includes the leading segment of an IPv6 address
|
IPv6AddressSection(IPv6AddressSegment[] segments,
int startIndex,
java.lang.Integer networkPrefixLength) |
IPv6AddressSection(IPv6AddressSegment segment,
int startIndex)
Constructs a single segment section with the segment at the given index in the address.
|
IPv6AddressSection(long highBytes,
long lowBytes,
int segmentCount) |
IPv6AddressSection(long highBytes,
long lowBytes,
int segmentCount,
java.lang.Integer networkPrefixLength) |
IPv6AddressSection(MACAddress eui)
Constructs the corresponding IPv6 address section from a modified EUI-64 (Extended Unique Identifier) address.
|
IPv6AddressSection(MACAddressSection eui)
Constructs the corresponding IPv6 address section from a modified EUI-64 (Extended Unique Identifier) address section.
|
Modifier and Type | Method and Description |
---|---|
IPv6AddressSection |
adjustPrefixBySegment(boolean nextSegment)
Increases or decreases prefix length to the next segment boundary.
|
IPv6AddressSection |
adjustPrefixBySegment(boolean nextSegment,
boolean zeroed)
Increases or decreases prefix length to the next segment boundary.
|
IPv6AddressSection |
adjustPrefixLength(int adjustment)
Increases or decreases prefix length by the given increment.
|
IPv6AddressSection |
adjustPrefixLength(int adjustment,
boolean zeroed)
Increases or decreases prefix length by the given increment.
|
IPv6AddressSection |
append(IPv6AddressSection other) |
IPv6AddressSection |
appendToNetwork(IPv6AddressSection other) |
IPv6AddressSection |
applyPrefixLength(int networkPrefixLength)
Applies the given prefix length to create a new segment series.
|
IPv6AddressSection |
assignMinPrefixForBlock()
Constructs an equivalent address section with the smallest CIDR prefix possible (largest network),
such that the range of values are a set of subnet blocks for that prefix.
|
IPv6AddressSection |
assignPrefixForSingleBlock()
Returns the equivalent CIDR address section with a prefix length for which the subnet block for that prefix matches the range of values in this section.
|
IPv6AddressSection |
bitwiseOr(IPv6AddressSection mask)
Equivalent to
bitwiseOr(IPv6AddressSection, boolean) with the second argument as false. |
IPv6AddressSection |
bitwiseOr(IPv6AddressSection mask,
boolean retainPrefix)
Does the bitwise disjunction with this address.
|
IPv6AddressSection |
bitwiseOrNetwork(IPv6AddressSection mask,
int networkPrefixLength)
Does the bitwise disjunction with this address.
|
boolean |
contains(AddressSection other)
Determines if one section contains another.
|
IPv6AddressSection |
createMaxHost() |
IPv6AddressSection |
createNonMixedSection() |
static IPv6AddressSection |
createSection(IPv6AddressNetwork.IPv6AddressCreator creator,
IPv6AddressSegment[] nonMixedSection,
IPv4Address mixedSection) |
boolean |
equals(java.lang.Object o) |
int |
getBitCount() |
int |
getBitsPerSegment()
Returns the number of bits comprising each segment in this series.
|
int |
getByteCount()
returns the number of bytes in each of the address components represented by this instance
|
int |
getBytesPerSegment()
Returns the number of bytes comprising each segment in this series.
|
IPv6AddressSegment |
getDivision(int index) |
IPv4AddressSection |
getEmbeddedIPv4AddressSection()
Gets the IPv4 section corresponding to the lowest (least-significant) 4 bytes in the original address,
which will correspond to between 0 and 4 bytes in this address.
|
IPv4AddressSection |
getEmbeddedIPv4AddressSection(int startIndex,
int endIndex)
Produces an IPv4 address section from any sequence of bytes in this IPv6 address section
|
IPv6AddressSection |
getHostSection()
Returns the host section of the series.
|
IPv6AddressSection |
getHostSection(int networkPrefixLength)
Returns the host section of the address as indicated by the network prefix length provided.
|
IPv4AddressNetwork |
getIPv4Network() |
IPv6Address |
getIPv6Address(IPv4Address mixedSection)
Create an IPv6 mixed address using the given address for the embedded IPv4 segments
|
IPAddress.IPVersion |
getIPVersion()
Returns the version of this segment series
|
java.lang.Iterable<IPv6AddressSection> |
getIterable()
Useful for using an instance in a "for-each loop".
|
IPv6AddressSection |
getLower()
If this represents a series with ranging values, returns a series representing the lower values of the range.
|
IPv6AddressSection |
getLowerNonZeroHost()
Similar to
IPAddressSegmentSeries.getLower() , but will not return a series that has a prefix length and whose host value is zero. |
MACAddressNetwork |
getMACNetwork() |
static java.math.BigInteger |
getMaxValue(int segmentCount) |
IPv6AddressSection.IPv6v4MixedAddressSection |
getMixedAddressSection() |
IPv6AddressNetwork |
getNetwork()
Returns the network object for series of the same version (eg IPv4, IPv6 and MAC each have their own network object)
|
IPv6AddressSection |
getNetworkSection()
Returns the network section of the series if the series has a CIDR network prefix length,
otherwise it returns the entire series as a prefixed series with prefix matching the address bit length.
|
IPv6AddressSection |
getNetworkSection(int networkPrefixLength)
Returns the network section of the series.
|
IPv6AddressSection |
getNetworkSection(int networkPrefixLength,
boolean withPrefixLength)
Returns the network section of the series.
|
IPAddressStringDivisionSeries[] |
getParts(IPAddressSection.IPStringBuilderOptions opts)
Get all representations of this address including this IPAddressSection.
|
IPAddressStringDivisionSeries[] |
getParts(IPv6AddressSection.IPv6StringBuilderOptions opts) |
java.math.BigInteger |
getPrefixCount()
If this has a prefix length, the count of the range of values in the prefix.
|
IPv6AddressSection |
getSection()
Gets the subsection from the series that comprises all segments
|
IPv6AddressSection |
getSection(int index)
Gets the subsection from the series starting from the given index
|
IPv6AddressSection |
getSection(int index,
int endIndex)
Gets the subsection from the series starting from the given index and ending just before the give endIndex
|
IPv6AddressSegment |
getSegment(int index)
Returns the segment from this series at the given index.
|
IPv6AddressSegment[] |
getSegments()
Returns the segments of this series of segments as an array.
|
void |
getSegments(java.util.Collection<? super IPv6AddressSegment> segs) |
void |
getSegments(int start,
int end,
java.util.Collection<? super IPv6AddressSegment> segs) |
IPv6AddressSection[] |
getSpanningPrefixBlocks(IPv6AddressSection other)
Produces the list of prefix block subnets that span from this series to the given series.
|
IPv6AddressSection |
getUpper()
If this represents a series with ranging values, returns a series representing the upper values of the range
If this represents a series with a single value in each segment, returns this.
|
IPAddressDivisionGrouping.RangeList |
getZeroRangeSegments() |
IPAddressDivisionGrouping.RangeList |
getZeroSegments() |
boolean |
hasUppercaseVariations(int base,
boolean lowerOnly)
Returns whether this subnet or address has alphabetic digits when printed.
|
IPv6AddressSection |
increment(long increment)
Returns the series from the subnet that is the given increment upwards into the subnet range,
or if the given increment is negative the given increment downwards into the subnet range,
or if this is just an individual series, it simply adds the increment to this.
|
IPv6AddressSection |
insert(int index,
IPv6AddressSection other) |
IPv6AddressSection |
intersect(IPv6AddressSection other)
Produces the subnet sections whose addresses are found in both this and the given argument.
|
boolean |
isEUI64()
Equivalent to isEUI64(false)
|
boolean |
isEUI64(boolean partial)
Whether this section is consistent with an EUI64 section,
which means it came from an extended 8 byte address,
and the corresponding segments in the middle match 0xff and 0xfe
|
boolean |
isIPv6() |
boolean |
isZero() |
java.util.Iterator<IPv6AddressSection> |
iterator()
Iterates through the individual segment series.
|
IPv6AddressSection |
mask(IPv6AddressSection mask)
Equivalent to
mask(IPv6AddressSection, boolean) with the second argument as false. |
IPv6AddressSection |
mask(IPv6AddressSection mask,
boolean retainPrefix)
Does the bitwise conjuction with this address.
|
IPv6AddressSection |
maskNetwork(IPv6AddressSection mask,
int networkPrefixLength)
Applies the given mask to the network section of the address as indicated by the given prefix length.
|
boolean |
matchesWithMask(IPAddressSection other,
IPAddressSection mask)
Applies the mask to this address section and then compares values with the given address section
|
IPv6AddressSection[] |
mergeBlocks(IPv6AddressSection... sections)
Merges this with the list of sections to produce the smallest array of prefix blocks, going from smallest to largest
|
java.util.Iterator<IPv6AddressSection> |
nonZeroHostIterator() |
java.util.Iterator<IPv6AddressSection> |
prefixBlockIterator()
Iterates through the individual prefix blocks.
|
IPv6AddressSection |
removePrefixLength()
Removes the prefix length.
|
IPv6AddressSection |
removePrefixLength(boolean zeroed)
Removes the prefix length.
|
IPv6AddressSection |
replace(int startIndex,
int endIndex,
IPv6AddressSection replacement,
int replacementStartIndex,
int replacementEndIndex)
Replaces segments starting from startIndex and ending before endIndex with the segments starting at replacementStartIndex and
ending before replacementEndIndex from the replacement section
|
IPv6AddressSection |
replace(int startIndex,
int endIndex,
IPv6AddressSection replacement,
int replacementStartIndex,
int replacementEndIndex,
boolean appendNetwork) |
IPv6AddressSection |
replace(int index,
IPv6AddressSection replacement)
Replace the segments of this section starting at the given index with the given replacement segments
|
IPv6AddressSection |
reverseBits(boolean perByte)
Returns a new series which has the bits reversed.
|
IPv6AddressSection |
reverseBytes()
Returns a new segment series with the bytes reversed.
|
IPv6AddressSection |
reverseBytesPerSegment()
Returns a new segment series with the bytes reversed within each segment.
|
IPv6AddressSection |
reverseSegments()
Returns a new segment series with the segments reversed.
|
java.util.Iterator<IPv6AddressSegment[]> |
segmentsIterator()
Iterates through the individual segments.
|
java.util.Iterator<IPv6AddressSegment[]> |
segmentsNonZeroHostIterator() |
IPv6AddressSection |
setPrefixLength(int networkPrefixLength)
Sets the prefix length.
|
IPv6AddressSection |
setPrefixLength(int networkPrefixLength,
boolean withZeros)
Sets the prefix length.
|
IPv6AddressSection[] |
subtract(IPv6AddressSection other)
Subtract the give subnet from this subnet, returning an array of sections for the result (the subnets will not be contiguous so an array is required).
|
IPAddressPartStringCollection |
toAllStringCollection()
Use this method with care...
|
java.lang.String |
toBase85String()
The base 85 string is described by RFC 1924
|
java.lang.String |
toCanonicalString()
This produces a canonical string.
|
java.lang.String |
toCanonicalWildcardString()
This produces a string similar to the canonical string and avoids the CIDR prefix.
|
java.lang.String |
toCompressedString()
This produces the shortest valid string for the address.
|
java.lang.String |
toCompressedWildcardString()
This is similar to toNormalizedWildcardString, avoiding the CIDR prefix, but with compression as well.
|
IPAddressPartStringCollection |
toDatabaseSearchStringCollection()
Returns a set of strings for search the standard string representations in a database
-compress the largest compressible segments or no compression (a:0:0:c:d:0:e:f or a::c:d:0:e:f)
-upper/lowercase is not considered because many databases are case-insensitive
|
MACAddressSection |
toEUI(boolean extended)
Returns the corresponding mac section, or null if this address section does not correspond to a mac section.
|
java.lang.String |
toFullString()
This produces a string with no compressed segments and all segments of full length,
which is 4 characters for IPv6 segments and 3 characters for IPv4 segments.
|
IPv6AddressSection |
toMaxHost()
Returns the segment series with a host of all ones.
|
IPv6AddressSection |
toMaxHost(int prefixLength)
Produces the series with host values of all one bits for the given prefix length.
|
java.lang.String |
toMixedString()
This produces the mixed IPv6/IPv4 string.
|
java.lang.String |
toNormalizedString()
The normalized string returned by this method is consistent with java.net.Inet6address.
|
java.lang.String |
toNormalizedString(IPAddressSection.IPStringOptions options)
Creates a customized string from this series.
|
static java.lang.String |
toNormalizedString(IPAddressSection.IPStringOptions options,
java.lang.CharSequence zone,
IPAddressStringDivisionSeries part) |
java.lang.String |
toNormalizedString(IPv6AddressSection.IPv6StringOptions options) |
java.lang.String |
toNormalizedString(IPv6AddressSection.IPv6StringOptions options,
java.lang.CharSequence zone) |
java.lang.String |
toNormalizedWildcardString()
This produces a string similar to the normalized string and avoids the CIDR prefix.
|
IPv6AddressSection |
toPrefixBlock()
If this series has a prefix length, returns the subnet block for that prefix.
|
IPv6AddressSection |
toPrefixBlock(int networkPrefixLength)
Returns the segment series of the same length that spans all hosts.
|
java.lang.String |
toPrefixLengthString()
Returns a string with a CIDR prefix length if this section has a network prefix length.
|
java.lang.String |
toReverseDNSLookupString()
Generates the reverse DNS lookup string
For 8.255.4.4 it is 4.4.255.8.in-addr.arpa
For 2001:db8::567:89ab it is b.a.9.8.7.6.5.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa
|
java.lang.String |
toSQLWildcardString()
This is the same as the string from toNormalizedWildcardString except that
it uses
Address.SEGMENT_SQL_WILDCARD instead of Address.SEGMENT_WILDCARD and also uses Address.SEGMENT_SQL_SINGLE_WILDCARD |
IPAddressPartStringCollection |
toStandardStringCollection()
Returns at most a couple dozen string representations:
-mixed (1:2:3:4:5:6:1.2.3.4)
-upper and lower case
-full compressions or no compression (a:0:0:c:d:0:e:f or a::c:d:0:e:f or a:0:b:c:d::e:f)
-full leading zeros (000a:0000:000b:000c:000d:0000:000e:000f)
-combinations thereof
|
IPAddressPartStringCollection |
toStringCollection(IPAddressSection.IPStringBuilderOptions options) |
IPAddressPartStringCollection |
toStringCollection(IPv6AddressSection.IPv6StringBuilderOptions opts) |
java.lang.String |
toSubnetString()
Produces a consistent subnet string.
|
IPv6AddressSection |
toZeroHost()
Returns the segment series with a host of zero.
|
IPv6AddressSection |
toZeroHost(int prefixLength)
Produces the series with host values of 0 for the given prefix length.
|
bitsPerSegment, bytesPerSegment, containsPrefixBlock, getBlockMaskPrefixLength, getCountImpl, getHostBitCount, getHostSegmentCount, getMinPrefixLengthForBlock, getNetworkSegmentCount, getNonZeroHostCount, getPrefixLengthForSingleBlock, getSegmentCount, getSegmentPrefixLength, getSegments, getSegments, getSegmentStrings, getStartsWithSQLClause, getStartsWithSQLClause, includesMaxHost, includesMaxHost, includesZeroHost, includesZeroHost, isEntireAddress, isFullRange, isIPv4, isSingleNetwork, toBinaryString, toHexString, toNormalizedString, toOctalString, toString
containsSinglePrefixBlock, getNetworkPrefixLength, getPrefixLength, isMore, isPrefixBlock, isPrefixed, isSinglePrefixBlock
compareTo, getBytes, getBytes, getCount, getDivisionCount, getDivisionStrings, getUpperBytes, getUpperBytes, getUpperValue, getValue, hashCode, includesMax, includesZero, isMax, isMultiple
getNetworkPrefixLength
containsSinglePrefixBlock, getDivisionStrings, getPrefixLength, getUpperValue, getValue, isMore, isPrefixBlock, isPrefixed, isSinglePrefixBlock
getDivisionCount
getBytes, getBytes, getCount, getUpperBytes, getUpperBytes, includesMax, includesZero, isMax, isMultiple
public IPv6AddressSection(IPv6AddressSegment segment)
segment
- public IPv6AddressSection(IPv6AddressSegment segment, int startIndex) throws java.lang.IllegalArgumentException
segment
- java.lang.IllegalArgumentException
public IPv6AddressSection(IPv6AddressSegment[] segments) throws AddressValueException
AddressValueException
public IPv6AddressSection(IPv6AddressSegment[] segments, java.lang.Integer networkPrefixLength) throws AddressValueException
segments
- an array containing the segments. Segments that are entirely part of the host section need not be provided, although the array must be the correct length.networkPrefixLength
- AddressValueException
public IPv6AddressSection(IPv6AddressSegment[] segments, int startIndex, java.lang.Integer networkPrefixLength) throws java.lang.IllegalArgumentException, AddressValueException
startIndex
- the index of the first segment where this section would be located in a full address, 0 for network sections or full addressessegments
- an array containing the segments. Segments that are entirely part of the host section need not be provided, although the array must be the correct length.networkPrefixLength
- java.lang.IllegalArgumentException
AddressValueException
public IPv6AddressSection(Address.SegmentValueProvider valueProvider, int segmentCount, java.lang.Integer networkPrefixLength) throws AddressValueException
AddressValueException
public IPv6AddressSection(Address.SegmentValueProvider lowerValueProvider, Address.SegmentValueProvider upperValueProvider, int segmentCount, java.lang.Integer networkPrefixLength) throws AddressValueException
AddressValueException
public IPv6AddressSection(Address.SegmentValueProvider valueProvider, int segmentCount) throws AddressValueException
AddressValueException
public IPv6AddressSection(Address.SegmentValueProvider lowerValueProvider, Address.SegmentValueProvider upperValueProvider, int segmentCount)
public IPv6AddressSection(byte[] bytes, int byteStartIndex, int byteEndIndex, java.lang.Integer prefix) throws AddressValueException
AddressValueException
public IPv6AddressSection(byte[] bytes, int byteStartIndex, int byteEndIndex) throws AddressValueException
AddressValueException
public IPv6AddressSection(byte[] bytes, java.lang.Integer prefix) throws AddressValueException
AddressValueException
public IPv6AddressSection(byte[] bytes) throws AddressValueException
AddressValueException
public IPv6AddressSection(java.math.BigInteger val, int segmentCount, java.lang.Integer networkPrefixLength) throws AddressValueException
AddressValueException
public IPv6AddressSection(java.math.BigInteger val, int segmentCount) throws AddressValueException
AddressValueException
public IPv6AddressSection(long highBytes, long lowBytes, int segmentCount, java.lang.Integer networkPrefixLength) throws PrefixLenException
PrefixLenException
public IPv6AddressSection(long highBytes, long lowBytes, int segmentCount)
public IPv6AddressSection(MACAddress eui)
If the supplied address is an 8 byte EUI-64, then it must match the required EUI-64 format of xx-xx-ff-fe-xx-xx with the ff-fe section in the middle. If the supplied address is a 6 byte MAC-48 or EUI-48, then the ff-fe pattern will be inserted.
The constructor will toggle the MAC U/L (universal/local) bit as required with EUI-64.
Any prefix length in the MAC address is ignored.
eui
- IncompatibleAddressException
- when the MAC address is an EUI-64 that cannot be converted to an IPv6 address (ff-fe section in middle)public IPv6AddressSection(MACAddressSection eui)
If the supplied address section comes from an 8 byte EUI-64, then it must match the required EUI-64 format of xx-xx-ff-fe-xx-xx with the ff-fe section in the middle. If the supplied address section comes from a 6 byte MAC-48 or EUI-48, then the ff-fe pattern will be inserted.
The constructor will toggle the MAC U/L (universal/local) bit as required with EUI-64.
Any prefix length in the MAC address section is ignored.
eui
- IncompatibleAddressException
- when the MAC address section is an EUI-64 that cannot be converted to an IPv6 address (ff-fe section in middle)public IPv6AddressSection getSection()
AddressSegmentSeries
getSection
in interface AddressSegmentSeries
getSection
in interface IPAddressSegmentSeries
public IPv6AddressSection getSection(int index)
AddressSegmentSeries
getSection
in interface AddressSegmentSeries
getSection
in interface IPAddressSegmentSeries
getSection
in class IPAddressSection
public IPv6AddressSection getSection(int index, int endIndex)
AddressSegmentSeries
getSection
in interface AddressSegmentSeries
getSection
in interface IPAddressSegmentSeries
getSection
in class IPAddressSection
public IPv6AddressSegment[] getSegments()
AddressSegmentSeries
AddressSegmentSeries.getSegment(int)
and AddressSegmentSeries.getSegmentCount()
instead when feasible.getSegments
in interface AddressSegmentSeries
getSegments
in interface IPAddressSegmentSeries
public IPv6AddressSection getLowerNonZeroHost()
IPAddressSegmentSeries
IPAddressSegmentSeries.getLower()
, but will not return a series that has a prefix length and whose host value is zero.
If this series has no prefix length, returns the same series as IPAddressSegmentSeries.getLower()
.getLowerNonZeroHost
in interface IPAddressSegmentSeries
getLowerNonZeroHost
in class IPAddressSection
public IPv6AddressSection getLower()
AddressSegmentSeries
getLower
in interface AddressComponent
getLower
in interface AddressSection
getLower
in interface AddressSegmentSeries
getLower
in interface IPAddressSegmentSeries
getLower
in class IPAddressSection
public IPv6AddressSection getUpper()
AddressSegmentSeries
getUpper
in interface AddressComponent
getUpper
in interface AddressSection
getUpper
in interface AddressSegmentSeries
getUpper
in interface IPAddressSegmentSeries
getUpper
in class IPAddressSection
public IPv6AddressSection reverseBits(boolean perByte)
IPAddressSegmentSeries
If this has an associated prefix length, then the prefix length is dropped in the reversed series.
If this represents a range of values that cannot be reversed,
because reversing the range results in a set of addresses that cannot be described by a range, then this throws IncompatibleAddressException
.
In such cases you can call IPAddressSegmentSeries.iterator()
, IPAddressSegmentSeries.getLower()
, IPAddressSegmentSeries.getUpper()
or some other method to transform the address
into an address representing a single value before reversing.
reverseBits
in interface AddressComponent
reverseBits
in interface AddressSection
reverseBits
in interface AddressSegmentSeries
reverseBits
in interface IPAddressSegmentSeries
reverseBits
in class IPAddressSection
perByte
- if true, only the bits in each byte are reversed, if false, then all bits in the address are reversedpublic IPv6AddressSection reverseBytes()
AddressSegmentSeries
reverseBytes
in interface AddressComponent
reverseBytes
in interface AddressSection
reverseBytes
in interface AddressSegmentSeries
reverseBytes
in interface IPAddressSegmentSeries
reverseBytes
in class IPAddressSection
public IPv6AddressSection reverseBytesPerSegment()
AddressSegmentSeries
reverseBytesPerSegment
in interface AddressSection
reverseBytesPerSegment
in interface AddressSegmentSeries
reverseBytesPerSegment
in interface IPAddressSegmentSeries
reverseBytesPerSegment
in class IPAddressSection
public IPv6AddressSection reverseSegments()
AddressSegmentSeries
IncompatibleAddressException
since all address series can reverse their segments.reverseSegments
in interface AddressSection
reverseSegments
in interface AddressSegmentSeries
reverseSegments
in interface IPAddressSegmentSeries
reverseSegments
in class IPAddressSection
public java.lang.Iterable<IPv6AddressSection> getIterable()
AddressComponent
AddressComponent.iterator()
directly.getIterable
in interface AddressComponent
getIterable
in interface AddressSection
getIterable
in interface AddressSegmentSeries
getIterable
in interface IPAddressSegmentSeries
getIterable
in class IPAddressSection
public java.util.Iterator<IPv6AddressSection> nonZeroHostIterator()
nonZeroHostIterator
in interface IPAddressSegmentSeries
nonZeroHostIterator
in class IPAddressSection
public java.util.Iterator<IPv6AddressSection> iterator()
AddressSegmentSeries
iterator
in interface AddressComponent
iterator
in interface AddressSection
iterator
in interface AddressSegmentSeries
iterator
in interface IPAddressSegmentSeries
iterator
in interface java.lang.Iterable<IPv6AddressSection>
iterator
in class IPAddressSection
public java.util.Iterator<IPv6AddressSection> prefixBlockIterator()
AddressSegmentSeries
AddressSegmentSeries.iterator()
prefixBlockIterator
in interface AddressSection
prefixBlockIterator
in interface AddressSegmentSeries
prefixBlockIterator
in interface IPAddressSegmentSeries
prefixBlockIterator
in class IPAddressSection
public java.util.Iterator<IPv6AddressSegment[]> segmentsNonZeroHostIterator()
segmentsNonZeroHostIterator
in interface IPAddressSegmentSeries
public java.util.Iterator<IPv6AddressSegment[]> segmentsIterator()
AddressSegmentSeries
segmentsIterator
in interface AddressSegmentSeries
segmentsIterator
in interface IPAddressSegmentSeries
public static java.math.BigInteger getMaxValue(int segmentCount)
public IPv6AddressSection increment(long increment)
AddressSegmentSeries
If the subnet has multiple values and the increment exceeds the subnet size, then the amount by which is exceeds the size is added to the upper series of the range (the final iterator value) or is subtracted from the lower series of the range (the first iterator value) if negative.
If the subnet is just a single address values, the series is simply incremented by the given value, positive or negative.
If a subnet has multiple values, a positive increment value is equivalent to the same number of values from the iterator. For instance, a increment of 1 is value 1 from the iterator, an increment of 2 is the second value from the iterator, and so on. A negative increment is equivalent to the same number of values preceding the upper bound of the iterator. For instance, an increment of -1 is the last value from the iterator, and increment of -2 is the second last value, and so on.
Therefore, to get the series just above the highest series of the subnet, use an increment of size:count > 1 ? count + 1 : 1
where count is the subnet size.
To get the series just below the lowest series of the subnet, use an increment of size:-(count > 1 ? count + 1 : 1)
where count is the subnet size.
increment
in interface AddressSection
increment
in interface AddressSegmentSeries
increment
in interface IPAddressSegmentSeries
increment
in class IPAddressSection
public java.math.BigInteger getPrefixCount()
AddressDivisionSeries
If this has no prefix length, returns the same value as AddressItem.getCount()
getPrefixCount
in interface AddressDivisionSeries
getPrefixCount
in class AddressDivisionGrouping
public IPv6AddressSegment getDivision(int index)
getDivision
in interface AddressDivisionSeries
getDivision
in interface AddressStringDivisionSeries
getDivision
in interface IPAddressStringDivisionSeries
getDivision
in class IPAddressSection
public IPv6AddressSegment getSegment(int index)
AddressSegmentSeries
getSegment
in interface AddressSegmentSeries
getSegment
in interface IPAddressSegmentSeries
getSegment
in class IPAddressSection
public void getSegments(java.util.Collection<? super IPv6AddressSegment> segs)
public void getSegments(int start, int end, java.util.Collection<? super IPv6AddressSegment> segs)
public boolean isEUI64()
public boolean isEUI64(boolean partial)
partial
- whether missing segments are considered a matchpublic MACAddressSection toEUI(boolean extended)
extended
- public IPv4AddressSection getEmbeddedIPv4AddressSection(int startIndex, int endIndex)
startIndex
- the byte index in this section to start fromendIndex
- the byte index in this section to end atjava.lang.IndexOutOfBoundsException
getEmbeddedIPv4AddressSection()
,
getMixedAddressSection()
public IPv4AddressSection getEmbeddedIPv4AddressSection()
getEmbeddedIPv4AddressSection(int, int)
,
getMixedAddressSection()
public IPv6AddressSection createNonMixedSection()
public IPv6AddressSection.IPv6v4MixedAddressSection getMixedAddressSection()
public static IPv6AddressSection createSection(IPv6AddressNetwork.IPv6AddressCreator creator, IPv6AddressSegment[] nonMixedSection, IPv4Address mixedSection) throws IncompatibleAddressException
IncompatibleAddressException
public IPv6Address getIPv6Address(IPv4Address mixedSection)
mixedSection
- the IPv4 address used to construct the terminating segments of the returned addresspublic int getBitsPerSegment()
AddressSegmentSeries
getBitsPerSegment
in interface AddressSegmentSeries
public int getBytesPerSegment()
AddressSegmentSeries
getBytesPerSegment
in interface AddressSegmentSeries
public int getBitCount()
getBitCount
in interface AddressItem
getBitCount
in class IPAddressSection
public int getByteCount()
AddressComponent
getByteCount
in interface AddressComponent
getByteCount
in class IPAddressSection
public boolean hasUppercaseVariations(int base, boolean lowerOnly)
public boolean isIPv6()
isIPv6
in class IPAddressSection
public IPAddress.IPVersion getIPVersion()
IPAddressSegmentSeries
getIPVersion
in interface IPAddressSegmentSeries
public IPv6AddressSection append(IPv6AddressSection other)
public IPv6AddressSection appendToNetwork(IPv6AddressSection other)
public IPv6AddressSection insert(int index, IPv6AddressSection other)
public IPv6AddressSection replace(int index, IPv6AddressSection replacement)
index
- replacement
- public IPv6AddressSection replace(int startIndex, int endIndex, IPv6AddressSection replacement, int replacementStartIndex, int replacementEndIndex)
startIndex
- endIndex
- replacement
- replacementStartIndex
- replacementEndIndex
- java.lang.IndexOutOfBoundsException
AddressValueException
- if the resulting section would exceed the maximum segment count for this address type and versionpublic IPv6AddressSection replace(int startIndex, int endIndex, IPv6AddressSection replacement, int replacementStartIndex, int replacementEndIndex, boolean appendNetwork)
public boolean contains(AddressSection other)
AddressSection
contains
in interface AddressSection
contains
in class IPAddressSection
public boolean matchesWithMask(IPAddressSection other, IPAddressSection mask)
IPAddressSection
matchesWithMask
in class IPAddressSection
public boolean equals(java.lang.Object o)
equals
in class IPAddressDivisionGrouping
public IPv6AddressSection intersect(IPv6AddressSection other) throws SizeMismatchException
This is also known as the conjunction of the two sets of address sections.
other
- SizeMismatchException
public IPv6AddressSection[] subtract(IPv6AddressSection other) throws SizeMismatchException
Computes the subnet difference, the set of addresses in this address section but not in the provided section. This is also known as the relative complement of the given argument in this subnet.
Keep in mind this is set subtraction, not subtraction of segment values. We have a subnet of addresses and we are removing some of those addresses.
other
- SizeMismatchException
- if the two sections have different sizespublic IPv6AddressNetwork getNetwork()
AddressSegmentSeries
getNetwork
in interface AddressSegmentSeries
getNetwork
in interface IPAddressStringDivisionSeries
getNetwork
in interface IPAddressSegmentSeries
getNetwork
in class IPAddressDivisionGrouping
public IPv4AddressNetwork getIPv4Network()
public MACAddressNetwork getMACNetwork()
public IPv6AddressSection adjustPrefixBySegment(boolean nextSegment)
AddressSegmentSeries
Follows the same rules as AddressSegmentSeries.adjustPrefixLength(int)
:
When prefix length is increased, the bits moved within the prefix become zero.
When a prefix length is decreased, the bits moved outside the prefix become zero.
adjustPrefixBySegment
in interface AddressSection
adjustPrefixBySegment
in interface AddressSegmentSeries
adjustPrefixBySegment
in interface IPAddressSegmentSeries
adjustPrefixBySegment
in class IPAddressSection
nextSegment
- whether to move prefix to previous or following segment coundarypublic IPv6AddressSection adjustPrefixBySegment(boolean nextSegment, boolean zeroed)
AddressSegmentSeries
adjustPrefixBySegment
in interface AddressSection
adjustPrefixBySegment
in interface AddressSegmentSeries
adjustPrefixBySegment
in interface IPAddressSegmentSeries
adjustPrefixBySegment
in class IPAddressSection
nextSegment
- whether to move prefix to previous or following segment coundaryzeroed
- whether the bits that move from one side of the prefix to the other become zero or retain their original valuespublic IPv6AddressSection adjustPrefixLength(int adjustment)
AddressSegmentSeries
When prefix length is increased, the bits moved within the prefix become zero. When the prefix is extended beyond the segment series boundary, it is removed. When a prefix length is decreased, the bits moved outside the prefix become zero.
adjustPrefixLength
in interface AddressSection
adjustPrefixLength
in interface AddressSegmentSeries
adjustPrefixLength
in interface IPAddressSegmentSeries
adjustPrefixLength
in class IPAddressSection
public IPv6AddressSection adjustPrefixLength(int adjustment, boolean zeroed)
AddressSegmentSeries
adjustPrefixLength
in interface AddressSection
adjustPrefixLength
in interface AddressSegmentSeries
adjustPrefixLength
in interface IPAddressSegmentSeries
adjustPrefixLength
in class IPAddressSection
adjustment
- the incrementzeroed
- whether the bits that move from one side of the prefix to the other become zero or retain their original valuespublic IPv6AddressSection applyPrefixLength(int networkPrefixLength) throws PrefixLenException
AddressSegmentSeries
Similar to AddressSegmentSeries.setPrefixLength(int)
except that prefix lengths are never increased.
When this series already has a prefix length that is less than or equal to the requested prefix length, this series is returned.
Otherwise the returned series has the given prefix length.
The bits moved outside the prefix will become zero in the returned series.
applyPrefixLength
in interface AddressSection
applyPrefixLength
in interface AddressSegmentSeries
applyPrefixLength
in interface IPAddressSegmentSeries
applyPrefixLength
in class IPAddressSection
PrefixLenException
AddressSegmentSeries.setPrefixLength(int)
public IPv6AddressSection setPrefixLength(int networkPrefixLength) throws PrefixLenException
AddressSegmentSeries
If this series has a prefix length, and the prefix length is increased, the bits moved within the prefix become zero.
When the prefix is extended beyond the segment series boundary, it is removed.
The bits that move from one side of the prefix length to the other (ie bits moved into the prefix or outside the prefix) are zeroed.
setPrefixLength
in interface AddressSection
setPrefixLength
in interface AddressSegmentSeries
setPrefixLength
in interface IPAddressSegmentSeries
setPrefixLength
in class IPAddressSection
PrefixLenException
AddressSegmentSeries.applyPrefixLength(int)
public IPv6AddressSection setPrefixLength(int networkPrefixLength, boolean withZeros) throws PrefixLenException
AddressSegmentSeries
When the prefix is extended beyond the segment series boundary, it is removed.
setPrefixLength
in interface AddressSection
setPrefixLength
in interface AddressSegmentSeries
setPrefixLength
in interface IPAddressSegmentSeries
setPrefixLength
in class IPAddressSection
withZeros
- whether the bits that move from one side of the prefix length to the other (ie bits moved into the prefix or outside the prefix) are zeroed.PrefixLenException
public IPv6AddressSection removePrefixLength()
IPAddressSegmentSeries
removePrefixLength
in interface AddressSection
removePrefixLength
in interface AddressSegmentSeries
removePrefixLength
in interface IPAddressSegmentSeries
removePrefixLength
in class IPAddressSection
IPAddressSegmentSeries.removePrefixLength(boolean)
public IPv6AddressSection removePrefixLength(boolean zeroed)
IPAddressSegmentSeries
IPAddressSegmentSeries.removePrefixLength()
removePrefixLength
in interface AddressSection
removePrefixLength
in interface AddressSegmentSeries
removePrefixLength
in interface IPAddressSegmentSeries
removePrefixLength
in class IPAddressSection
zeroed
- whether the host bits become zero.public IPv6AddressSection bitwiseOrNetwork(IPv6AddressSection mask, int networkPrefixLength) throws IncompatibleAddressException, PrefixLenException, SizeMismatchException
maskNetwork(IPv6AddressSection, int)
which does the bitwise conjunction.
Any existing prefix length is dropped for the new prefix length and the mask is applied up to the end the new prefix length.
mask
- IncompatibleAddressException
PrefixLenException
SizeMismatchException
public IPv6AddressSection bitwiseOr(IPv6AddressSection mask) throws IncompatibleAddressException
bitwiseOr(IPv6AddressSection, boolean)
with the second argument as false.IncompatibleAddressException
public IPv6AddressSection bitwiseOr(IPv6AddressSection mask, boolean retainPrefix) throws IncompatibleAddressException, SizeMismatchException
mask(IPv6AddressSection)
which does the bitwise conjunction.mask
- retainPrefix
- whether to drop the prefixIncompatibleAddressException
SizeMismatchException
public IPv6AddressSection toZeroHost() throws IncompatibleAddressException
IPAddressSegmentSeries
The resultant series will have the same prefix length if AddressNetwork.getPrefixConfiguration()
is not AddressNetwork.PrefixConfiguration.ALL_PREFIXED_ADDRESSES_ARE_SUBNETS
,
otherwise it will no longer have a prefix length.
For instance, you can get the network address for a subnet as follows:
String addrStr = "1.2.3.4/16";
IPAddress address = new IPAddressString(addrStr).getAddress();
IPAddress networkAddress = address.toZeroHost(); //1.2.0.0
toZeroHost
in interface IPAddressSegmentSeries
toZeroHost
in class IPAddressSection
IncompatibleAddressException
public IPv6AddressSection toZeroHost(int prefixLength)
IPAddressSegmentSeries
If this series has the same prefix length, then the resulting series will too, otherwise the resulting series will have no prefix length.
This is nearly equivalent to doing the mask (bitwise conjunction) of this address series with the network mask for the given prefix length, but without the possibility of IncompatibleAddressException that can occur when applying a mask to a range of values. Instead, in this case, if the resulting series has a range of values, then the resulting series range boundaries will have host values of 0, but not necessarily the intervening values.
For instance, you can get the network address for a subnet of prefix length 16 as follows:
String addrStr = "1.2.3.4";
IPAddress address = new IPAddressString(addrStr).getAddress();
IPAddress networkAddress = address.toZeroHost(16); //1.2.0.0
toZeroHost
in interface IPAddressSegmentSeries
toZeroHost
in class IPAddressSection
public IPv6AddressSection toMaxHost() throws IncompatibleAddressException
IPAddressSegmentSeries
The resultant series will have the same prefix length if AddressNetwork.getPrefixConfiguration()
is not AddressNetwork.PrefixConfiguration.ALL_PREFIXED_ADDRESSES_ARE_SUBNETS
,
otherwise it will no longer have a prefix length.
For instance, you can get the broadcast address for a subnet as follows:
String addrStr = "1.2.3.4/16";
IPAddress address = new IPAddressString(addrStr).getAddress();
IPAddress broadcastAddress = address.toMaxHost(); //1.2.255.255
toMaxHost
in interface IPAddressSegmentSeries
toMaxHost
in class IPAddressSection
IncompatibleAddressException
public IPv6AddressSection createMaxHost()
public IPv6AddressSection toMaxHost(int prefixLength)
IPAddressSegmentSeries
If this series has the same prefix length, then the resulting series will too, otherwise the resulting series will have no prefix length.
This is nearly equivalent to doing the bitwise or (bitwise disjunction) of this address series with the network mask for the given prefix length, but without the possibility of IncompatibleAddressException that can occur when applying a mask to a range of values. Instead, in this case, if the resulting series has a range of values, then the resulting series range boundaries will have host values of all ones, but not necessarily the intervening values.
For instance, you can get the broadcast address for a subnet of prefix length 16 as follows:
String addrStr = "1.2.3.4";
IPAddress address = new IPAddressString(addrStr).getAddress();
IPAddress broadcastAddress = address.toMaxHost(16); //1.2.255.255
toMaxHost
in interface IPAddressSegmentSeries
toMaxHost
in class IPAddressSection
public IPv6AddressSection mask(IPv6AddressSection mask, boolean retainPrefix) throws IncompatibleAddressException, SizeMismatchException
mask
- retainPrefix
- whether to drop the prefixIncompatibleAddressException
SizeMismatchException
public IPv6AddressSection mask(IPv6AddressSection mask) throws IncompatibleAddressException
mask(IPv6AddressSection, boolean)
with the second argument as false.IncompatibleAddressException
public IPv6AddressSection maskNetwork(IPv6AddressSection mask, int networkPrefixLength) throws IncompatibleAddressException, PrefixLenException, SizeMismatchException
bitwiseOr(IPv6AddressSection)
or replace(int, IPv6AddressSection)
mask
- networkPrefixLength
- IncompatibleAddressException
PrefixLenException
SizeMismatchException
public IPv6AddressSection getNetworkSection()
IPAddressSegmentSeries
getNetworkSection
in interface IPAddressSegmentSeries
public IPv6AddressSection getNetworkSection(int networkPrefixLength) throws PrefixLenException
IPAddressSegmentSeries
getNetworkSection
in interface IPAddressSegmentSeries
PrefixLenException
public IPv6AddressSection getNetworkSection(int networkPrefixLength, boolean withPrefixLength) throws PrefixLenException
IPAddressSegmentSeries
getNetworkSection
in interface IPAddressSegmentSeries
withPrefixLength
- whether the resulting section will have networkPrefixLength as the associated prefix length or notPrefixLenException
public IPv6AddressSection getHostSection()
IPAddressSegmentSeries
getHostSection
in interface IPAddressSegmentSeries
public IPv6AddressSection getHostSection(int networkPrefixLength) throws PrefixLenException
IPAddressSegmentSeries
getHostSection
in interface IPAddressSegmentSeries
PrefixLenException
public IPv6AddressSection toPrefixBlock()
IPAddressSegmentSeries
toPrefixBlock
in interface AddressSection
toPrefixBlock
in interface AddressSegmentSeries
toPrefixBlock
in interface IPAddressSegmentSeries
toPrefixBlock
in class IPAddressSection
public IPv6AddressSection assignPrefixForSingleBlock()
IPAddressSection
If no such prefix length exists, returns null.
If this address represents just a single address, "this" is returned.
assignPrefixForSingleBlock
in interface IPAddressSegmentSeries
assignPrefixForSingleBlock
in class IPAddressSection
IPAddressSegmentSeries.toPrefixBlock()
,
IPAddressSegmentSeries.assignMinPrefixForBlock()
public IPv6AddressSection assignMinPrefixForBlock()
IPAddressSection
assignMinPrefixForBlock
in interface IPAddressSegmentSeries
assignMinPrefixForBlock
in class IPAddressSection
IPAddressSegmentSeries.toPrefixBlock()
,
IPAddressSegmentSeries.assignPrefixForSingleBlock()
public IPv6AddressSection toPrefixBlock(int networkPrefixLength) throws PrefixLenException
IPAddressSegmentSeries
toPrefixBlock
in interface IPAddressSegmentSeries
toPrefixBlock
in class IPAddressSection
PrefixLenException
public IPv6AddressSection[] getSpanningPrefixBlocks(IPv6AddressSection other) throws AddressPositionException
other
- AddressPositionException
public IPv6AddressSection[] mergeBlocks(IPv6AddressSection... sections) throws SizeMismatchException, AddressPositionException
sections
- the sections to merge with thisSizeMismatchException
AddressPositionException
public java.lang.String toCompressedString()
toCompressedString
in interface AddressSegmentSeries
public java.lang.String toCanonicalString()
toCanonicalString
in interface AddressSegmentSeries
public java.lang.String toMixedString()
public java.lang.String toFullString()
toFullString
in interface IPAddressSegmentSeries
public java.lang.String toCompressedWildcardString()
IPAddressSegmentSeries
toCompressedWildcardString
in interface IPAddressSegmentSeries
public java.lang.String toPrefixLengthString()
IPAddressSegmentSeries
toPrefixLengthString
in interface IPAddressSegmentSeries
public java.lang.String toSubnetString()
IPAddressSegmentSeries
toSubnetString
in interface IPAddressSegmentSeries
public java.lang.String toCanonicalWildcardString()
IPAddressSegmentSeries
toCanonicalWildcardString
in interface IPAddressSegmentSeries
public java.lang.String toNormalizedWildcardString()
IPAddressSegmentSeries
toNormalizedWildcardString
in interface IPAddressSegmentSeries
public java.lang.String toSQLWildcardString()
IPAddressSegmentSeries
Address.SEGMENT_SQL_WILDCARD
instead of Address.SEGMENT_WILDCARD
and also uses Address.SEGMENT_SQL_SINGLE_WILDCARD
toSQLWildcardString
in interface IPAddressSegmentSeries
public java.lang.String toNormalizedString()
toNormalizedString
in interface AddressComponent
public java.lang.String toBase85String()
public java.lang.String toReverseDNSLookupString()
IPAddressSegmentSeries
toReverseDNSLookupString
in interface IPAddressSegmentSeries
public java.lang.String toNormalizedString(IPAddressSection.IPStringOptions options)
IPAddressSegmentSeries
toNormalizedString
in interface IPAddressSegmentSeries
toNormalizedString
in class IPAddressSection
public java.lang.String toNormalizedString(IPv6AddressSection.IPv6StringOptions options)
public java.lang.String toNormalizedString(IPv6AddressSection.IPv6StringOptions options, java.lang.CharSequence zone)
public static java.lang.String toNormalizedString(IPAddressSection.IPStringOptions options, java.lang.CharSequence zone, IPAddressStringDivisionSeries part)
public IPAddressPartStringCollection toStandardStringCollection()
IPAddressSection
toStandardStringCollection
in class IPAddressSection
public IPAddressPartStringCollection toAllStringCollection()
IPAddressSection
toAllStringCollection
in class IPAddressSection
public IPAddressPartStringCollection toDatabaseSearchStringCollection()
IPAddressSection
toDatabaseSearchStringCollection
in class IPAddressSection
public IPAddressPartStringCollection toStringCollection(IPAddressSection.IPStringBuilderOptions options)
toStringCollection
in interface IPAddressSegmentSeries
public IPAddressPartStringCollection toStringCollection(IPv6AddressSection.IPv6StringBuilderOptions opts)
public IPAddressStringDivisionSeries[] getParts(IPAddressSection.IPStringBuilderOptions opts)
IPAddressSection
IPAddressDivisionGrouping
getParts
in class IPAddressSection
public IPAddressStringDivisionSeries[] getParts(IPv6AddressSection.IPv6StringBuilderOptions opts)
public IPAddressDivisionGrouping.RangeList getZeroSegments()
getZeroSegments
in class IPAddressDivisionGrouping
public IPAddressDivisionGrouping.RangeList getZeroRangeSegments()
getZeroRangeSegments
in class IPAddressDivisionGrouping
public boolean isZero()
isZero
in interface AddressItem
isZero
in class AddressDivisionGrouping