public class IPv6AddressSection extends IPAddressSection implements 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.SeriesCreator, IPAddressSection.TriFunction<R,S>, IPAddressSection.WildcardOptionsIPAddressDivisionGrouping.Range, IPAddressDivisionGrouping.RangeListAddressDivisionGrouping.DivisionLengthProvider, AddressDivisionGrouping.DivisionValueProvider, 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,
Integer networkPrefixLength) |
IPv6AddressSection(Address.SegmentValueProvider valueProvider,
int segmentCount) |
IPv6AddressSection(Address.SegmentValueProvider valueProvider,
int segmentCount,
Integer networkPrefixLength) |
IPv6AddressSection(BigInteger val,
int segmentCount) |
IPv6AddressSection(BigInteger val,
int segmentCount,
Integer networkPrefixLength) |
IPv6AddressSection(byte[] bytes) |
IPv6AddressSection(byte[] bytes,
Integer prefix) |
IPv6AddressSection(byte[] bytes,
int byteStartIndex,
int byteEndIndex) |
IPv6AddressSection(byte[] bytes,
int byteStartIndex,
int byteEndIndex,
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,
Integer networkPrefixLength)
Use this constructor for any address section that includes the leading segment of an IPv6 address
|
IPv6AddressSection(IPv6AddressSegment[] segments,
int startIndex,
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,
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)
Deprecated.
|
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.
|
Iterator<IPv6AddressSection> |
blockIterator(int segmentCount)
Iterates through series that can be obtained by iterating through all the upper segments up to the given segment count.
|
AddressComponentSpliterator<IPv6AddressSection> |
blockSpliterator(int segmentCount)
Partitions and traverses through the individual sequential blocks created from each of the individual values up to the given segment count.
|
Stream<IPv6AddressSection> |
blockStream(int segmentCount)
Returns a sequential stream of the individual blocks created from each of the individual values up to the given segment count.
|
boolean |
contains(AddressSection other)
Determines if one section contains another.
|
IPv6AddressSection |
coverWithPrefixBlock()
Returns the minimal-size prefix block that covers all the values in this series.
|
IPv6AddressSection |
coverWithPrefixBlock(IPv6AddressSection other) |
IPv6AddressSection |
createMaxHost() |
IPv6AddressSection |
createNonMixedSection() |
static IPv6AddressSection |
createSection(IPv6AddressNetwork.IPv6AddressCreator creator,
IPv6AddressSegment[] nonMixedSection,
IPv4Address mixedSection) |
BigInteger |
enumerate(AddressSection other)
Indicates where an address section sits relative to the ordering of individual address sections within this section.
|
boolean |
equals(Object o)
Two groupings are equal if:
- they match type/version (ipv4, ipv6, mac, or a specific grouping class)
- they match division counts
- each division matches bit counts
- each division matches their specific grouping class
- each division matches values
Prefix lengths, for those groupings and/or divisionsS that have them, are ignored.
|
int |
getBitCount()
Provides the number of bits comprising this address item
|
int |
getBitsPerSegment()
Returns the number of bits comprising each segment in this series.
|
int |
getByteCount()
Provides the number of bytes required for this address item, rounding up if the bit count is not a multiple of 8
|
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 |
getHostMask()
Returns the host mask associated with the CIDR network prefix length of this series.
|
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
|
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 BigInteger |
getMaxValue(int segmentCount) |
IPv6AddressSection.IPv6v4MixedAddressSection |
getMixedAddressSection() |
IPv6AddressNetwork |
getNetwork()
Returns the network object for components of the same version (eg IPv4, IPv6 and MAC each have their own network object)
|
IPv6AddressSection |
getNetworkMask()
Returns the network mask associated with the CIDR network prefix length of this series.
|
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) |
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.
|
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
The first segment is at index 0.
|
IPv6AddressSection |
getSection(int index,
int endIndex)
Gets the subsection from the series starting from the given index and ending just before the give endIndex
The first segment is at index 0.
|
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(Collection<? super IPv6AddressSegment> segs) |
void |
getSegments(int start,
int end,
Collection<? super IPv6AddressSegment> segs) |
IPv6AddressSection |
getUpper()
If this represents a series with ranging values, returns a series representing the upper values of the range.
|
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(BigInteger bigIncrement) |
IPv6AddressSection |
increment(long increment)
Returns the series from the subnet that is the given increment upwards into the subnet range, with the increment of 0
returning the first address in the range.
|
IPv6AddressSection |
incrementBoundary(long increment)
If the given increment is positive, adds the value to the upper series (
AddressSegmentSeries.getUpper()) in the subnet range to produce a new series. |
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()
Returns whether this item matches the value of zero
|
Iterator<IPv6AddressSection> |
iterator()
Iterates through the individual address components.
|
long[] |
longValues() |
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[] |
mergePrefixBlocks(IPv6AddressSection... sections)
Deprecated.
|
IPv6AddressSection[] |
mergeToPrefixBlocks(IPv6AddressSection... sections)
Merges this with the list of sections to produce the smallest array of prefix blocks.
|
IPv6AddressSection[] |
mergeToSequentialBlocks(IPv6AddressSection... sections)
Merges this with the list of sections to produce the smallest array of sequential block subnets, going from smallest to largest
|
Iterator<IPv6AddressSection> |
nonZeroHostIterator()
Similar to the iterator, but series with a host of zero are skipped.
|
boolean |
overlaps(AddressSection other)
Determines if one section overlaps another.
|
Iterator<IPv6AddressSection> |
prefixBlockIterator()
Iterates through the individual prefix blocks.
|
AddressComponentSpliterator<IPv6AddressSection> |
prefixBlockSpliterator()
Partitions and traverses through the individual prefix blocks for the prefix length of this series.
|
Stream<IPv6AddressSection> |
prefixBlockStream()
Returns a sequential stream of the individual prefix blocks for the prefix length of this series.
|
boolean |
prefixContains(IPAddressSection o)
Returns whether the prefix of this address contains all values of the same bits in the given address or subnet
|
boolean |
prefixEquals(AddressSection o)
Determines if the argument section matches this section up to the prefix length of this section.
|
Iterator<IPv6AddressSection> |
prefixIterator()
Iterates through the individual prefixes.
|
AddressComponentSpliterator<IPv6AddressSection> |
prefixSpliterator()
Partitions and traverses through the individual prefixes for the prefix length of this series.
|
Stream<IPv6AddressSection> |
prefixStream()
Returns a sequential stream of the individual prefixes for the prefix length of this series.
|
IPv6AddressSection |
removePrefixLength()
Deprecated.
|
IPv6AddressSection |
removePrefixLength(boolean zeroed)
Deprecated.
|
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.
|
Iterator<IPv6AddressSegment[]> |
segmentsIterator()
Iterates through the individual segments.
|
Iterator<IPv6AddressSegment[]> |
segmentsNonZeroHostIterator()
Similar to the segments iterator, but series with a host of zero are skipped.
|
AddressComponentRangeSpliterator<IPv6AddressSection,IPv6AddressSegment[]> |
segmentsSpliterator()
Partitions and traverses through the individual segment arrays.
|
Stream<IPv6AddressSegment[]> |
segmentsStream()
Returns a sequential stream of the individual segment arrays.
|
Iterator<IPv6AddressSection> |
sequentialBlockIterator()
Iterates through the sequential series that make up this series.
|
AddressComponentSpliterator<IPv6AddressSection> |
sequentialBlockSpliterator()
Partitions and traverses through the individual sequential blocks.
|
Stream<IPv6AddressSection> |
sequentialBlockStream()
Returns a sequential stream of the individual sequential blocks.
|
IPv6AddressSection |
setPrefixLength(int networkPrefixLength)
Sets the prefix length.
|
IPv6AddressSection |
setPrefixLength(int networkPrefixLength,
boolean withZeros)
Sets the prefix length.
|
IPv6AddressSection |
setPrefixLength(int networkPrefixLength,
boolean withZeros,
boolean zeroHostIsBlock)
Sets the prefix length while allowing the caller to control whether bits moved in or out of the prefix become zero,
and whether a zero host for the new prefix bits can be translated into a prefix block.
|
IPv6AddressSection[] |
spanWithPrefixBlocks()
Produces an array of prefix blocks that spans the same set of values.
|
IPv6AddressSection[] |
spanWithPrefixBlocks(IPv6AddressSection other)
Produces the list of prefix block subnets that span from this series to the given series.
|
IPv6AddressSection[] |
spanWithRangedSegments(IPv6AddressSection other)
Deprecated.
|
IPv6AddressSection[] |
spanWithSequentialBlocks()
Produces an array of blocks that are sequential that cover the same set of sections as this.
|
IPv6AddressSection[] |
spanWithSequentialBlocks(IPv6AddressSection other)
Produces a list of range subnets that span from this series to the given series.
|
AddressComponentSpliterator<IPv6AddressSection> |
spliterator()
Partitions and traverses through the individual address components.
|
Stream<IPv6AddressSection> |
stream()
Returns a sequential stream of the individual address components.
|
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...
|
String |
toBase85String()
The base 85 string is described by RFC 1924
|
String |
toCanonicalString()
This produces a canonical string.
|
String |
toCanonicalWildcardString()
This produces a string similar to the canonical string and avoids the CIDR prefix.
|
String |
toCompressedString()
This produces the shortest valid string for the address.
|
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.
|
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.
|
String |
toMixedString()
This produces the mixed IPv6/IPv4 string.
|
String |
toNormalizedString()
The normalized string returned by this method is consistent with java.net.Inet6address.
|
String |
toNormalizedString(IPAddressSection.IPStringOptions options)
Creates a customized string from this series.
|
static String |
toNormalizedString(IPAddressSection.IPStringOptions options,
CharSequence zone,
IPAddressStringDivisionSeries part) |
String |
toNormalizedString(IPv6AddressSection.IPv6StringOptions options) |
String |
toNormalizedString(IPv6AddressSection.IPv6StringOptions options,
CharSequence zone) |
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.
|
String |
toPrefixLengthString()
Returns a string with a CIDR prefix length if this section has a network prefix length.
|
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
|
String |
toSegmentedBinaryString()
Writes this IP address segment series as a segments of binary values preceded by the "0b" prefix.
|
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) |
String |
toSubnetString()
Produces a consistent subnet string.
|
IPv6AddressSection |
toZeroHost()
Returns the segment series with a host of zero, the host being the bits following the prefix length.
|
IPv6AddressSection |
toZeroHost(int prefixLength)
Produces the series with host values of 0 for the given prefix length.
|
IPv6AddressSection |
toZeroNetwork()
Returns the segment series with a network of zero, the network being the bits within the prefix length.
|
long[] |
upperLongValues() |
IPv6AddressSection |
withoutPrefixLength()
Provides the same address with no prefix.
|
bitsPerSegment, bytesPerSegment, containsNonZeroHosts, containsPrefixBlock, getBlockCount, getBlockMaskPrefixLength, getCountImpl, getMaxSegmentValue, getMinPrefixLengthForBlock, getNonZeroHostCount, getPrefixLengthForSingleBlock, getSegmentCount, getSegments, getSegments, getSegmentStrings, getSequentialBlockCount, getStartsWithSQLClause, getStartsWithSQLClause, includesMaxHost, includesMaxHost, includesZeroHost, includesZeroHost, isEntireAddress, isFullRange, isIPv4, isSingleNetwork, isSinglePrefixBlock, isZeroHost, isZeroHost, toBinaryString, toHexString, toNormalizedString, toOctalString, toStringcontainsSinglePrefixBlock, getLeadingBitCount, getNetworkPrefixLength, getPrefixLength, getTrailingBitCount, isMore, isPrefixBlockhashCodegetBytes, getBytes, getBytes, getCount, getDivisionCount, getDivisionStrings, getPrefixCount, getUpperBytes, getUpperBytes, getUpperBytes, getUpperValue, getValue, includesMax, includesZero, isMax, isMultiple, isPrefixed, isSequentialgetPrefixLenComparatorgetNetworkPrefixLengthgetPrefixLength, isPrefixBlock, isPrefixedisOneBit, testBitgetCount, getDivisionStrings, getPrefixCount, getPrefixLength, getSequentialBlockIndex, isMore, isPrefixBlock, isPrefixed, isSequentialgetDivisionCountstream, streampublic IPv6AddressSection(IPv6AddressSegment segment)
segment - public IPv6AddressSection(IPv6AddressSegment segment, int startIndex) throws AddressValueException
segment - AddressValueExceptionpublic IPv6AddressSection(IPv6AddressSegment[] segments) throws AddressValueException
AddressValueExceptionpublic IPv6AddressSection(IPv6AddressSegment[] segments, 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 - AddressValueExceptionpublic IPv6AddressSection(IPv6AddressSegment[] segments, int startIndex, Integer networkPrefixLength) throws 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 - AddressValueExceptionpublic IPv6AddressSection(Address.SegmentValueProvider valueProvider, int segmentCount, Integer networkPrefixLength) throws AddressValueException
AddressValueExceptionpublic IPv6AddressSection(Address.SegmentValueProvider lowerValueProvider, Address.SegmentValueProvider upperValueProvider, int segmentCount, Integer networkPrefixLength) throws AddressValueException
AddressValueExceptionpublic IPv6AddressSection(Address.SegmentValueProvider valueProvider, int segmentCount) throws AddressValueException
AddressValueExceptionpublic IPv6AddressSection(Address.SegmentValueProvider lowerValueProvider, Address.SegmentValueProvider upperValueProvider, int segmentCount)
public IPv6AddressSection(byte[] bytes,
int byteStartIndex,
int byteEndIndex,
Integer prefix)
throws AddressValueException
AddressValueExceptionpublic IPv6AddressSection(byte[] bytes,
int byteStartIndex,
int byteEndIndex)
throws AddressValueException
AddressValueExceptionpublic IPv6AddressSection(byte[] bytes,
Integer prefix)
throws AddressValueException
AddressValueExceptionpublic IPv6AddressSection(byte[] bytes)
throws AddressValueException
AddressValueExceptionpublic IPv6AddressSection(BigInteger val, int segmentCount, Integer networkPrefixLength) throws AddressValueException
AddressValueExceptionpublic IPv6AddressSection(BigInteger val, int segmentCount) throws AddressValueException
AddressValueExceptionpublic IPv6AddressSection(long highBytes,
long lowBytes,
int segmentCount,
Integer networkPrefixLength)
throws PrefixLenException
PrefixLenExceptionpublic 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()
AddressSegmentSeriesgetSection in interface AddressSegmentSeriesgetSection in interface IPAddressSegmentSeriespublic IPv6AddressSection getSection(int index)
AddressSegmentSeriesgetSection in interface AddressSegmentSeriesgetSection in interface IPAddressSegmentSeriesgetSection in class IPAddressSectionpublic IPv6AddressSection getSection(int index, int endIndex)
AddressSegmentSeriesgetSection in interface AddressSegmentSeriesgetSection in interface IPAddressSegmentSeriesgetSection in class IPAddressSectionpublic IPv6AddressSegment[] getSegments()
AddressSegmentSeriesAddressSegmentSeries.getSegment(int) and AddressSegmentSeries.getSegmentCount() instead when feasible.getSegments in interface AddressSegmentSeriesgetSegments in interface IPAddressSegmentSeriespublic IPv6AddressSection getLowerNonZeroHost()
IPAddressSegmentSeriesIPAddressSegmentSeries.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 IPAddressSegmentSeriesgetLowerNonZeroHost in class IPAddressSectionpublic IPv6AddressSection getLower()
AddressSegmentSeriesgetLower in interface AddressSectiongetLower in interface AddressSegmentSeriesgetLower in interface AddressComponentRangegetLower in interface IPAddressSegmentSeriesgetLower in class IPAddressSectionpublic IPv6AddressSection getUpper()
AddressSegmentSeriesgetUpper in interface AddressSectiongetUpper in interface AddressSegmentSeriesgetUpper in interface AddressComponentRangegetUpper in interface IPAddressSegmentSeriesgetUpper in class IPAddressSectionpublic long[] longValues()
public long[] upperLongValues()
public IPv6AddressSection reverseBits(boolean perByte)
IPAddressSegmentSeriesIf 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 AddressComponentreverseBits in interface AddressSectionreverseBits in interface AddressSegmentSeriesreverseBits in interface IPAddressSegmentSeriesreverseBits in class IPAddressSectionperByte - if true, only the bits in each byte are reversed, if false, then all bits in the address are reversedpublic IPv6AddressSection reverseBytes()
AddressSegmentSeriesreverseBytes in interface AddressComponentreverseBytes in interface AddressSectionreverseBytes in interface AddressSegmentSeriesreverseBytes in interface IPAddressSegmentSeriesreverseBytes in class IPAddressSectionpublic IPv6AddressSection reverseBytesPerSegment()
AddressSegmentSeriesreverseBytesPerSegment in interface AddressSectionreverseBytesPerSegment in interface AddressSegmentSeriesreverseBytesPerSegment in interface IPAddressSegmentSeriesreverseBytesPerSegment in class IPAddressSectionpublic IPv6AddressSection reverseSegments()
AddressSegmentSeriesIncompatibleAddressException since all address series can reverse their segments.reverseSegments in interface AddressSectionreverseSegments in interface AddressSegmentSeriesreverseSegments in interface IPAddressSegmentSeriesreverseSegments in class IPAddressSectionpublic Iterable<IPv6AddressSection> getIterable()
AddressComponentRangeAddressComponentRange.iterator() directly.getIterable in interface AddressSectiongetIterable in interface AddressSegmentSeriesgetIterable in interface AddressComponentRangegetIterable in interface IPAddressSegmentSeriesgetIterable in class IPAddressSectionpublic Iterator<IPv6AddressSection> nonZeroHostIterator()
IPAddressSegmentSeriesnonZeroHostIterator in interface IPAddressSegmentSeriesnonZeroHostIterator in class IPAddressSectionpublic Iterator<IPv6AddressSection> iterator()
AddressComponentRangeAn address component can represent an individual segment, address, or section, or it can represent multiple, typically a subnet of addresses or a range of segment or section values.
Call AddressItem.isMultiple() to determine if this instance represents multiple, or AddressItem.getCount() for the count.
iterator in interface AddressSectioniterator in interface AddressSegmentSeriesiterator in interface AddressComponentRangeiterator in interface IPAddressSegmentSeriesiterator in interface Iterable<IPv6AddressSection>iterator in class IPAddressSectionpublic AddressComponentSpliterator<IPv6AddressSection> spliterator()
AddressComponentRangespliterator in interface AddressComponentspliterator in interface AddressSectionspliterator in interface AddressSegmentSeriesspliterator in interface AddressComponentRangespliterator in interface IPAddressSegmentSeriesspliterator in interface Iterable<IPv6AddressSection>spliterator in class IPAddressSectionpublic Stream<IPv6AddressSection> stream()
AddressComponentRangeBaseStream.parallel() on the returned stream.stream in interface AddressSectionstream in interface AddressSegmentSeriesstream in interface AddressComponentRangestream in interface IPAddressSegmentSeriesstream in class IPAddressSectionpublic Iterator<IPv6AddressSection> prefixIterator()
AddressSegmentSeries
If the series has no prefix length, then this is equivalent to AddressSegmentSeries.iterator()
prefixIterator in interface AddressSectionprefixIterator in interface AddressSegmentSeriesprefixIterator in interface IPAddressSegmentSeriesprefixIterator in class IPAddressSectionpublic AddressComponentSpliterator<IPv6AddressSection> prefixSpliterator()
AddressSegmentSeriesprefixSpliterator in interface AddressSectionprefixSpliterator in interface AddressSegmentSeriesprefixSpliterator in interface IPAddressSegmentSeriesprefixSpliterator in class IPAddressSectionpublic Stream<IPv6AddressSection> prefixStream()
AddressSegmentSeriesBaseStream.parallel() on the returned stream.prefixStream in interface AddressSectionprefixStream in interface AddressSegmentSeriesprefixStream in interface IPAddressSegmentSeriesprefixStream in class IPAddressSectionpublic Iterator<IPv6AddressSection> prefixBlockIterator()
AddressSegmentSeries
If the series has no prefix length, then this is equivalent to AddressSegmentSeries.iterator()
prefixBlockIterator in interface AddressSectionprefixBlockIterator in interface AddressSegmentSeriesprefixBlockIterator in interface IPAddressSegmentSeriesprefixBlockIterator in class IPAddressSectionpublic AddressComponentSpliterator<IPv6AddressSection> prefixBlockSpliterator()
AddressSegmentSeriesprefixBlockSpliterator in interface AddressSectionprefixBlockSpliterator in interface AddressSegmentSeriesprefixBlockSpliterator in interface IPAddressSegmentSeriesprefixBlockSpliterator in class IPAddressSectionpublic Stream<IPv6AddressSection> prefixBlockStream()
AddressSegmentSeriesBaseStream.parallel() on the returned stream.prefixBlockStream in interface AddressSectionprefixBlockStream in interface AddressSegmentSeriesprefixBlockStream in interface IPAddressSegmentSeriesprefixBlockStream in class IPAddressSectionpublic Iterator<IPv6AddressSection> blockIterator(int segmentCount)
IPAddressSegmentSeriesFor instance, given the IPv4 subnet 1-2.3-4.5-6.7, given the count argument 2, it will iterate through 1.3.5-6.7, 1.4.5-6.7, 2.3.5-6.7, 2.4.5-6.7
blockIterator in interface IPAddressSegmentSeriesblockIterator in class IPAddressSectionpublic AddressComponentSpliterator<IPv6AddressSection> blockSpliterator(int segmentCount)
IPAddressSegmentSeriesblockSpliterator in interface IPAddressSegmentSeriesblockSpliterator in class IPAddressSectionpublic Stream<IPv6AddressSection> blockStream(int segmentCount)
IPAddressSegmentSeriesBaseStream.parallel() on the returned stream.blockStream in interface IPAddressSegmentSeriesblockStream in class IPAddressSectionpublic Iterator<IPv6AddressSection> sequentialBlockIterator()
IPAddressSegmentSeriesIPAddressSegmentSeries.blockIterator(int) with that segment count.
For instance, given the IPv4 subnet 1-2.3-4.5-6.7-8, it will iterate through 1.3.5.7-8, 1.3.6.7-8, 1.4.5.7-8, 1.4.6.7-8, 2.3.5.7-8, 2.3.6.7-8, 2.4.6.7-8, 2.4.6.7-8.
Use IPAddressSegmentSeries.getSequentialBlockCount() to get the count of iterated elements.
sequentialBlockIterator in interface IPAddressSegmentSeriessequentialBlockIterator in class IPAddressSectionpublic AddressComponentSpliterator<IPv6AddressSection> sequentialBlockSpliterator()
IPAddressSegmentSeriessequentialBlockSpliterator in interface IPAddressSegmentSeriessequentialBlockSpliterator in class IPAddressSectionpublic Stream<IPv6AddressSection> sequentialBlockStream()
IPAddressSegmentSeriesBaseStream.parallel() on the returned stream.
Use IPAddressSegmentSeries.getSequentialBlockCount() to get the count of streamed elements.
sequentialBlockStream in interface IPAddressSegmentSeriessequentialBlockStream in class IPAddressSectionpublic Iterator<IPv6AddressSegment[]> segmentsNonZeroHostIterator()
IPAddressSegmentSeriessegmentsNonZeroHostIterator in interface IPAddressSegmentSeriespublic Iterator<IPv6AddressSegment[]> segmentsIterator()
AddressSegmentSeriessegmentsIterator in interface AddressSegmentSeriessegmentsIterator in interface IPAddressSegmentSeriespublic AddressComponentRangeSpliterator<IPv6AddressSection,IPv6AddressSegment[]> segmentsSpliterator()
AddressSegmentSeriessegmentsSpliterator in interface AddressSegmentSeriessegmentsSpliterator in interface IPAddressSegmentSeriespublic Stream<IPv6AddressSegment[]> segmentsStream()
AddressSegmentSeriesBaseStream.parallel() on the returned stream.segmentsStream in interface AddressSegmentSeriessegmentsStream in interface IPAddressSegmentSeriespublic static BigInteger getMaxValue(int segmentCount)
public IPv6AddressSection incrementBoundary(long increment)
AddressSegmentSeriesAddressSegmentSeries.getUpper()) in the subnet range to produce a new series.
If the given increment is negative, adds the value to the lower series (AddressSegmentSeries.getLower()) in the subnet range to produce a new series.
If the increment is zero, returns this.
In the case where the series is a single value, this simply returns the address produced by adding the given increment to this address series.
incrementBoundary in interface AddressSectionincrementBoundary in interface AddressSegmentSeriesincrementBoundary in interface IPAddressSegmentSeriesincrementBoundary in class IPAddressSectionpublic IPv6AddressSection increment(BigInteger bigIncrement)
public IPv6AddressSection increment(long increment)
AddressSegmentSeriesIf the subnet has multiple values and the increment exceeds the subnet size, then the amount by which it exceeds the size - 1 is added to the upper series of the range (the final iterator value).
If the increment is negative, it is added to the lower series of the range (the first iterator value).
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 AddressSegmentSeries.iterator()
For instance, a increment of 0 is the first value from the iterator, an increment of 1 is the second value from the iterator, and so on.
A negative increment added to the subnet count is equivalent to the same number of values preceding the upper bound of the iterator.
For instance, an increment of count - 1 is the last value from the iterator, an increment of count - 2 is the second last value, and so on.
An increment of size count gives you the series just above the highest series of the subnet. To get the series just below the lowest series of the subnet, use the increment -1.
increment in interface AddressSectionincrement in interface AddressSegmentSeriesincrement in interface IPAddressSegmentSeriesincrement in class IPAddressSectionpublic BigInteger getPrefixCount(int prefixLength)
AddressItemgetPrefixCount in interface AddressDivisionSeriesgetPrefixCount in interface AddressItempublic IPv6AddressSegment getDivision(int index)
getDivision in interface AddressDivisionSeriesgetDivision in interface IPAddressDivisionSeriesgetDivision in interface AddressStringDivisionSeriesgetDivision in interface IPAddressStringDivisionSeriesgetDivision in class IPAddressSectionpublic IPv6AddressSegment getSegment(int index)
AddressSegmentSeriesAddressDivisionSeries.getDivision(int), the difference being that all segments in a given series are the same bit count, while divisions can have variable length.getSegment in interface AddressSegmentSeriesgetSegment in interface IPAddressSegmentSeriesgetSegment in class IPAddressSectionpublic void getSegments(Collection<? super IPv6AddressSegment> segs)
public void getSegments(int start,
int end,
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 atIndexOutOfBoundsExceptiongetEmbeddedIPv4AddressSection(),
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
IncompatibleAddressExceptionpublic IPv6Address getIPv6Address(IPv4Address mixedSection)
mixedSection - the IPv4 address used to construct the terminating segments of the returned addresspublic int getBitsPerSegment()
AddressSegmentSeriesgetBitsPerSegment in interface AddressSegmentSeriespublic int getBytesPerSegment()
AddressSegmentSeriesgetBytesPerSegment in interface AddressSegmentSeriespublic int getBitCount()
AddressItemgetBitCount in interface AddressDivisionSeriesgetBitCount in interface AddressItemgetBitCount in class IPAddressSectionpublic int getByteCount()
AddressItemgetByteCount in interface AddressItemgetByteCount in class IPAddressSectionpublic boolean hasUppercaseVariations(int base,
boolean lowerOnly)
public boolean isIPv6()
isIPv6 in class IPAddressSectionpublic IPAddress.IPVersion getIPVersion()
IPAddressSegmentSeriesgetIPVersion in interface IPAddressSegmentSeriespublic 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 - IndexOutOfBoundsExceptionAddressValueException - 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 overlaps(AddressSection other)
AddressSectionSections must have the same number of segments to be comparable.
For sections which are aware of their position in an address (IPv6 and MAC), their respective positions must match to be comparable.
overlaps in interface AddressSectionpublic boolean contains(AddressSection other)
AddressSectionSections must have the same number of segments to be comparable.
For sections which are aware of their position in an address (IPv6 and MAC), their respective positions must match to be comparable.
contains in interface AddressSectioncontains in class IPAddressSectionpublic BigInteger enumerate(AddressSection other)
AddressSectionDetermines how many address section elements precede the given address section element, if the given address section is within this address section. If above the range, it is the distance to the upper boundary added to the address section count less one, and if below the range, the distance to the lower boundary.
In other words, if the given address section is not in this section but above it, returns the number of individual address sections preceding the given address section from the upper section boundary, added to one less than the total number of individual address sections within. If the given address section is not in this section but below it, returns the number of individual address sections following the given address section to the lower section boundary.
enumerate returns null when the argument is a multi-valued section. The argument must be an individual address section.
When this address section is also single-valued, the returned value is the distance (difference) between this address section and the argument address section.
enumerate is the inverse of the increment method:
enumerate in interface AddressSectionpublic boolean prefixEquals(AddressSection o)
AddressSectionThe entire prefix of this section must be present in the other section to be comparable.
For sections which are aware of their position in an address (IPv6 and MAC), the argument section must have the same or an earlier position in the address to match all prefix segments of this section, and the matching is lined up relative to the position.
prefixEquals in interface AddressSectionpublic boolean prefixContains(IPAddressSection o)
IPAddressSectionprefixContains in class IPAddressSectionpublic boolean matchesWithMask(IPAddressSection other, IPAddressSection mask)
IPAddressSectionmatchesWithMask in class IPAddressSectionpublic boolean equals(Object o)
AddressDivisionGroupingBaseequals in class IPAddressDivisionGroupingpublic IPv6AddressSection intersect(IPv6AddressSection other) throws SizeMismatchException
This is also known as the conjunction of the two sets of address sections.
other - SizeMismatchExceptionpublic 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()
AddressComponentgetNetwork in interface AddressComponentgetNetwork in interface IPAddressStringDivisionSeriesgetNetwork in interface IPAddressSegmentSeriesgetNetwork in class IPAddressDivisionGroupingpublic 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.
To avoid the zeroing behaviour, use AddressSegmentSeries.adjustPrefixBySegment(boolean, boolean) with second arg false.
adjustPrefixBySegment in interface AddressSectionadjustPrefixBySegment in interface AddressSegmentSeriesadjustPrefixBySegment in interface IPAddressSegmentSeriesadjustPrefixBySegment in class IPAddressSectionnextSegment - whether to move prefix to previous or following segment boundarypublic IPv6AddressSection adjustPrefixBySegment(boolean nextSegment, boolean zeroed)
AddressSegmentSeriesadjustPrefixBySegment in interface AddressSectionadjustPrefixBySegment in interface AddressSegmentSeriesadjustPrefixBySegment in interface IPAddressSegmentSeriesadjustPrefixBySegment in class IPAddressSectionnextSegment - whether to move prefix to previous or following segment boundaryzeroed - 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.
To avoid the zeroing behaviour, use AddressSegmentSeries.adjustPrefixLength(int, boolean) with second arg false.
adjustPrefixLength in interface AddressSectionadjustPrefixLength in interface AddressSegmentSeriesadjustPrefixLength in interface IPAddressSegmentSeriesadjustPrefixLength in class IPAddressSectionpublic IPv6AddressSection adjustPrefixLength(int adjustment, boolean zeroed)
AddressSegmentSeriesadjustPrefixLength in interface AddressSectionadjustPrefixLength in interface AddressSegmentSeriesadjustPrefixLength in interface IPAddressSegmentSeriesadjustPrefixLength in class IPAddressSectionadjustment - the incrementzeroed - whether the bits that move from one side of the prefix to the other become zero or retain their original values@Deprecated public 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 AddressSectionapplyPrefixLength in interface AddressSegmentSeriesapplyPrefixLength in interface IPAddressSegmentSeriesapplyPrefixLength in class IPAddressSectionPrefixLenExceptionAddressSegmentSeries.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.
For an alternative that does not set bits to zero, use AddressSegmentSeries.setPrefixLength(int, boolean) with the second argument as false.
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 AddressSectionsetPrefixLength in interface AddressSegmentSeriessetPrefixLength in interface IPAddressSegmentSeriessetPrefixLength in class IPAddressSectionPrefixLenExceptionpublic IPv6AddressSection setPrefixLength(int networkPrefixLength, boolean withZeros) throws PrefixLenException
AddressSegmentSeriesWhen the prefix is extended beyond the segment series boundary, it is removed.
setPrefixLength in interface AddressSectionsetPrefixLength in interface AddressSegmentSeriessetPrefixLength in interface IPAddressSegmentSeriessetPrefixLength in class IPAddressSectionwithZeros - 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.PrefixLenExceptionpublic IPv6AddressSection setPrefixLength(int networkPrefixLength, boolean withZeros, boolean zeroHostIsBlock) throws PrefixLenException
IPAddressSectionIPAddressSection.setPrefixLength(int, boolean) and IPAddressSection.setPrefixLength(int)
use a value of true for zeroed and for zeroHostIsBlock.
For example, when zeroHostIsBlock is true, applying to 1.2.0.0 the prefix length 16 results in 1.2.*.*/16
Or if you start with 1.2.0.0/24, setting the prefix length to 16 results in a zero host followed by the existing prefix block, which is then converted to a full prefix block, 1.2.*.*/16
When both zeroed and zeroHostIsBlock are true, applying the prefix length of 16 to 1.2.4.0/24 also results in a zero host followed by the existing prefix block, which is then converted to a full prefix block, 1.2.*.*/16.
When both zeroed and zeroHostIsBlock are false, the resulting address always encompasses the same set of addresses as the original, albeit with a different prefix length.
setPrefixLength in class IPAddressSectionPrefixLenException@Deprecated public IPv6AddressSection removePrefixLength()
AddressSegmentSeries
If the series already has a prefix length, the bits outside the prefix become zero.
Use AddressSegmentSeries.withoutPrefixLength() to remove the prefix length without changing the series values.
Equivalent to calling removePrefixLength(true)
removePrefixLength in interface AddressSectionremovePrefixLength in interface AddressSegmentSeriesremovePrefixLength in interface IPAddressSegmentSeriesremovePrefixLength in class IPAddressSectionfor an alternative which does not change the address series values.public IPv6AddressSection withoutPrefixLength()
AddressSegmentSeries
Use AddressSegmentSeries.removePrefixLength() as an alternative that deletes the host at the same time by zeroing the host values.
withoutPrefixLength in interface AddressSectionwithoutPrefixLength in interface AddressSegmentSerieswithoutPrefixLength in interface IPAddressSegmentSerieswithoutPrefixLength in class IPAddressSection@Deprecated public IPv6AddressSection removePrefixLength(boolean zeroed)
AddressSegmentSeriesAddressSegmentSeries.removePrefixLength()removePrefixLength in interface AddressSectionremovePrefixLength in interface AddressSegmentSeriesremovePrefixLength in interface IPAddressSegmentSeriesremovePrefixLength in class IPAddressSectionzeroed - whether the bits outside the prefix become zeropublic 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 - IncompatibleAddressExceptionPrefixLenExceptionSizeMismatchExceptionpublic IPv6AddressSection bitwiseOr(IPv6AddressSection mask) throws IncompatibleAddressException
bitwiseOr(IPv6AddressSection, boolean) with the second argument as false.IncompatibleAddressExceptionpublic IPv6AddressSection bitwiseOr(IPv6AddressSection mask, boolean retainPrefix) throws IncompatibleAddressException, SizeMismatchException
mask(IPv6AddressSection) which does the bitwise conjunction.mask - retainPrefix - whether to drop the prefixIncompatibleAddressExceptionSizeMismatchExceptionpublic IPv6AddressSection toZeroHost() throws IncompatibleAddressException
IPAddressSegmentSeries
The default behaviour is that the resultant series will have the same prefix length.
The resultant series will not have a prefix length if AddressNetwork.getPrefixConfiguration() is AddressNetwork.PrefixConfiguration.ALL_PREFIXED_ADDRESSES_ARE_SUBNETS.
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 IPAddressSegmentSeriestoZeroHost in class IPAddressSectionIncompatibleAddressExceptionIPAddressSegmentSeries.toZeroNetwork()public IPv6AddressSection toZeroHost(int prefixLength)
IPAddressSegmentSeriesIf 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 IPAddressSegmentSeriestoZeroHost in class IPAddressSectionpublic IPv6AddressSection toZeroNetwork()
IPAddressSegmentSeries
The default behaviour is that the resultant series will have the same prefix length.
The resultant series will not have a prefix length if AddressNetwork.getPrefixConfiguration() is AddressNetwork.PrefixConfiguration.ALL_PREFIXED_ADDRESSES_ARE_SUBNETS.
toZeroNetwork in interface IPAddressSegmentSeriestoZeroNetwork in class IPAddressSectionIPAddressSegmentSeries.toZeroHost()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 IPAddressSegmentSeriestoMaxHost in class IPAddressSectionIncompatibleAddressExceptionpublic IPv6AddressSection createMaxHost()
public IPv6AddressSection toMaxHost(int prefixLength)
IPAddressSegmentSeriesIf 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 IPAddressSegmentSeriestoMaxHost in class IPAddressSectionpublic IPv6AddressSection mask(IPv6AddressSection mask, boolean retainPrefix) throws IncompatibleAddressException, SizeMismatchException
mask - retainPrefix - whether to drop the prefixIncompatibleAddressExceptionSizeMismatchExceptionpublic IPv6AddressSection mask(IPv6AddressSection mask) throws IncompatibleAddressException, SizeMismatchException
mask(IPv6AddressSection, boolean) with the second argument as false.public IPv6AddressSection maskNetwork(IPv6AddressSection mask, int networkPrefixLength) throws IncompatibleAddressException, PrefixLenException, SizeMismatchException
bitwiseOr(IPv6AddressSection) or replace(int, IPv6AddressSection)mask - networkPrefixLength - IncompatibleAddressExceptionPrefixLenExceptionSizeMismatchExceptionpublic IPv6AddressSection getHostMask()
IPAddressSegmentSeriesgetHostMask in interface IPAddressSegmentSeriesgetHostMask in class IPAddressSectionpublic IPv6AddressSection getNetworkMask()
IPAddressSegmentSeriesgetNetworkMask in interface IPAddressSegmentSeriesgetNetworkMask in class IPAddressSectionpublic IPv6AddressSection getNetworkSection()
IPAddressSegmentSeriesgetNetworkSection in interface IPAddressSegmentSeriespublic IPv6AddressSection getNetworkSection(int networkPrefixLength) throws PrefixLenException
IPAddressSegmentSeriesgetNetworkSection in interface IPAddressSegmentSeriesPrefixLenExceptionpublic IPv6AddressSection getNetworkSection(int networkPrefixLength, boolean withPrefixLength) throws PrefixLenException
IPAddressSegmentSeriesgetNetworkSection in interface IPAddressSegmentSerieswithPrefixLength - whether the resulting section will have networkPrefixLength as the associated prefix length or notPrefixLenExceptionpublic IPv6AddressSection getHostSection()
IPAddressSegmentSeriesgetHostSection in interface IPAddressSegmentSeriespublic IPv6AddressSection getHostSection(int networkPrefixLength) throws PrefixLenException
IPAddressSegmentSeriesgetHostSection in interface IPAddressSegmentSeriesPrefixLenExceptionpublic IPv6AddressSection toPrefixBlock()
IPAddressSegmentSeriestoPrefixBlock in interface AddressSectiontoPrefixBlock in interface AddressSegmentSeriestoPrefixBlock in interface IPAddressSegmentSeriestoPrefixBlock in class IPAddressSectionpublic IPv6AddressSection assignPrefixForSingleBlock()
IPAddressSectionIf no such prefix length exists, returns null.
If this address represents just a single address, "this" is returned.
assignPrefixForSingleBlock in interface IPAddressSegmentSeriesassignPrefixForSingleBlock in class IPAddressSectionIPAddressSegmentSeries.toPrefixBlock(),
IPAddressSegmentSeries.assignMinPrefixForBlock()public IPv6AddressSection assignMinPrefixForBlock()
IPAddressSectionassignMinPrefixForBlock in interface IPAddressSegmentSeriesassignMinPrefixForBlock in class IPAddressSectionIPAddressSegmentSeries.toPrefixBlock(),
IPAddressSegmentSeries.assignPrefixForSingleBlock()public IPv6AddressSection toPrefixBlock(int networkPrefixLength) throws PrefixLenException
IPAddressSegmentSeriestoPrefixBlock in interface IPAddressSegmentSeriestoPrefixBlock in class IPAddressSectionPrefixLenExceptionpublic IPv6AddressSection coverWithPrefixBlock()
IPAddressSegmentSeriescoverWithPrefixBlock in interface IPAddressSegmentSeriescoverWithPrefixBlock in class IPAddressSectionpublic IPv6AddressSection coverWithPrefixBlock(IPv6AddressSection other) throws AddressConversionException
AddressConversionExceptionpublic IPv6AddressSection[] spanWithPrefixBlocks()
Unlike spanWithPrefixBlocks(IPv6AddressSection) this method only includes blocks that are a part of this section.
spanWithPrefixBlocks in interface IPAddressSegmentSeriespublic IPv6AddressSection[] spanWithPrefixBlocks(IPv6AddressSection other) throws AddressPositionException
other - AddressPositionException@Deprecated public IPv6AddressSection[] spanWithRangedSegments(IPv6AddressSection other)
spanWithSequentialBlocks(IPv6AddressSection)other - public IPv6AddressSection[] spanWithSequentialBlocks() throws AddressConversionException
This array can be shorter than that produced by spanWithPrefixBlocks() and is never longer.
Unlike spanWithSequentialBlocks(IPv6AddressSection) this method only includes values that are a part of this section.
spanWithSequentialBlocks in interface IPAddressSegmentSeriesAddressConversionExceptionpublic IPv6AddressSection[] spanWithSequentialBlocks(IPv6AddressSection other) throws AddressPositionException
other - AddressPositionException@Deprecated public IPv6AddressSection[] mergePrefixBlocks(IPv6AddressSection... sections) throws SizeMismatchException
mergeToPrefixBlocks(IPv6AddressSection...)sections - SizeMismatchExceptionpublic IPv6AddressSection[] mergeToPrefixBlocks(IPv6AddressSection... sections) throws SizeMismatchException, AddressPositionException
The resulting array is sorted from lowest address value to highest, regardless of the size of each prefix block.
In version 5.3.1 and earlier, the result was sorted from single address to smallest blocks to largest blocks.
For that ordering, sort with IPAddressSegmentSeries.getPrefixLenComparator():
Arrays.sort(result, IPAddressSegmentSeries.getPrefixLenComparator());
sections - the sections to merge with thisSizeMismatchExceptionAddressPositionExceptionpublic IPv6AddressSection[] mergeToSequentialBlocks(IPv6AddressSection... sections) throws SizeMismatchException
The resulting array is sorted by lower address, regardless of the size of each prefix block.
In version 5.3.1 and earlier, the result was sorted from single address to smallest blocks to largest blocks.
For that ordering, sort with IPAddressSegmentSeries.getPrefixLenComparator():
Arrays.sort(result, IPAddressSegmentSeries.getPrefixLenComparator());
sections - the sections to merge with thisSizeMismatchExceptionpublic String toCompressedString()
toCompressedString in interface AddressSegmentSeriespublic String toCanonicalString()
toCanonicalString in interface AddressSegmentSeriespublic String toMixedString()
public String toFullString()
toFullString in interface IPAddressSegmentSeriespublic String toCompressedWildcardString()
IPAddressSegmentSeriestoCompressedWildcardString in interface IPAddressSegmentSeriespublic String toPrefixLengthString()
IPAddressSegmentSeriestoPrefixLengthString in interface IPAddressSegmentSeriespublic String toSubnetString()
IPAddressSegmentSeriestoSubnetString in interface IPAddressSegmentSeriespublic String toCanonicalWildcardString()
IPAddressSegmentSeriestoCanonicalWildcardString in interface IPAddressSegmentSeriespublic String toNormalizedWildcardString()
IPAddressSegmentSeriestoNormalizedWildcardString in interface IPAddressSegmentSeriespublic String toSQLWildcardString()
IPAddressSegmentSeriesAddress.SEGMENT_SQL_WILDCARD instead of Address.SEGMENT_WILDCARD and also uses Address.SEGMENT_SQL_SINGLE_WILDCARDtoSQLWildcardString in interface IPAddressSegmentSeriespublic String toNormalizedString()
toNormalizedString in interface AddressComponentpublic String toBase85String() throws IncompatibleAddressException
IncompatibleAddressExceptionpublic String toReverseDNSLookupString()
IPAddressSegmentSeriestoReverseDNSLookupString in interface IPAddressSegmentSeriespublic String toSegmentedBinaryString()
IPAddressSegmentSeriestoSegmentedBinaryString in interface IPAddressSegmentSeriespublic String toNormalizedString(IPAddressSection.IPStringOptions options)
IPAddressSegmentSeriestoNormalizedString in interface IPAddressSegmentSeriestoNormalizedString in class IPAddressSectionpublic String toNormalizedString(IPv6AddressSection.IPv6StringOptions options)
public String toNormalizedString(IPv6AddressSection.IPv6StringOptions options, CharSequence zone)
public static String toNormalizedString(IPAddressSection.IPStringOptions options, CharSequence zone, IPAddressStringDivisionSeries part)
public IPAddressPartStringCollection toStandardStringCollection()
IPAddressSectiontoStandardStringCollection in class IPAddressSectionpublic IPAddressPartStringCollection toAllStringCollection()
IPAddressSectiontoAllStringCollection in class IPAddressSectionpublic IPAddressPartStringCollection toDatabaseSearchStringCollection()
IPAddressSectiontoDatabaseSearchStringCollection in class IPAddressSectionpublic IPAddressPartStringCollection toStringCollection(IPAddressSection.IPStringBuilderOptions options)
toStringCollection in interface IPAddressSegmentSeriespublic IPAddressPartStringCollection toStringCollection(IPv6AddressSection.IPv6StringBuilderOptions opts)
public IPAddressStringDivisionSeries[] getParts(IPAddressSection.IPStringBuilderOptions opts)
IPAddressSectionIPAddressDivisionGroupinggetParts in class IPAddressSectionpublic IPAddressStringDivisionSeries[] getParts(IPv6AddressSection.IPv6StringBuilderOptions opts)
public IPAddressDivisionGrouping.RangeList getZeroSegments()
getZeroSegments in class IPAddressDivisionGroupingpublic IPAddressDivisionGrouping.RangeList getZeroRangeSegments()
getZeroRangeSegments in class IPAddressDivisionGroupingpublic boolean isZero()
AddressItemisZero in interface AddressItemisZero in class AddressDivisionGroupingBase