public class IPv6AddressSegment extends IPAddressSegment implements java.lang.Iterable<IPv6AddressSegment>
AddressDivision.BitwiseOrResult, AddressDivision.MaskResult| Modifier and Type | Field and Description |
|---|---|
static int |
BITS_PER_CHAR |
static int |
MAX_CHARS |
| Constructor and Description |
|---|
IPv6AddressSegment(int value)
Constructs a segment of an IPv6 address with the given value.
|
IPv6AddressSegment(int value,
java.lang.Integer segmentPrefixLength)
Constructs a segment of an IPv6 address.
|
IPv6AddressSegment(int lower,
int upper,
java.lang.Integer segmentPrefixLength)
Constructs a segment of an IPv6 address with the given range of values.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
contains(AddressSegment other) |
boolean |
equals(java.lang.Object other)
Two divisions are equal if they:
- they match type/version (ipv4, ipv6, mac, or a specific division class)
- match bit counts
- match values
Prefix lengths, for those divisions that have them, are ignored.
|
int |
getBitCount()
Provides the number of bits comprising this address item
|
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 |
getDefaultTextualRadix() |
IPAddress.IPVersion |
getIPVersion() |
java.lang.Iterable<IPv6AddressSegment> |
getIterable()
Useful for using an instance in a "for-each loop".
|
IPv6AddressSegment |
getLower()
If this segment represents a range of values, returns a segment representing just the lowest value in the range, otherwise returns this.
|
int |
getMaxDigitCount() |
int |
getMaxSegmentValue()
Gets the maximum possible value for this type of segment (for the highest range value of this particular segment, use
AddressSegment.getUpper() |
long |
getMaxValue() |
IPv6AddressNetwork |
getNetwork() |
<S extends AddressSegment> |
getSplitSegments(S[] segs,
int index,
AddressNetwork.AddressSegmentCreator<S> creator)
Converts this IPv6 address segment into smaller segments,
copying them into the given array starting at the given index.
|
IPv6AddressSegment |
getUpper()
If this segment represents a range of values, returns a segment representing just the highest value in the range, otherwise returns this.
|
boolean |
isIPv6() |
java.util.Iterator<IPv6AddressSegment> |
iterator()
Iterates through the individual elements of this address component.
|
java.util.Iterator<IPv6AddressSegment> |
prefixBlockIterator()
Iterates through the individual prefix blocks.
|
java.util.Iterator<IPv6AddressSegment> |
prefixBlockIterator(int prefixLength)
Iterates through the individual prefix blocks according to the given segment prefix length.
|
boolean |
prefixEquals(AddressSegment other,
int segmentPrefixLength) |
boolean |
prefixEquals(IPAddressSegment other) |
java.util.Iterator<IPv6AddressSegment> |
prefixIterator()
Iterates through the individual prefixes.
|
IPv6AddressSegment |
removePrefixLength() |
IPv6AddressSegment |
removePrefixLength(boolean zeroed) |
IPv6AddressSegment |
reverseBits(boolean perByte)
Returns a new AddressComponent with the bits reversed.
|
IPv6AddressSegment |
reverseBytes()
Returns an AddressComponent with the bytes reversed.
|
IPv6AddressSegment |
toHostSegment(java.lang.Integer bits)
used by getHostSection, see
IPAddressSegmentSeries.getHostSection(int) |
IPv6AddressSegment |
toNetworkSegment(java.lang.Integer segmentPrefixLength)
used by constructors of IPAddressSection, see
IPAddressSegmentSeries.getNetworkSection(int, boolean) |
IPv6AddressSegment |
toNetworkSegment(java.lang.Integer segmentPrefixLength,
boolean withPrefixLength)
used by getNetworkSection and by constructors of IPAddressSection, see
IPAddressSegmentSeries.getNetworkSection(int, boolean) |
IPv6AddressSegment |
withoutPrefixLength() |
bitwiseOrRange, getBitCount, getByteCount, getDefaultTextualRadix, getDivisionValue, getDivisionValueCount, getMaxSegmentValue, getMinPrefixLengthForBlock, getPrefixValueCount, getSegmentPrefixLength, getSegmentValue, getUpperDivisionValue, getUpperSegmentValue, getValueCount, hashCode, includesMax, includesZero, isBoundedBy, isIPv4, isMultiple, isPrefixBlock, maskRange, matches, matchesWithMask, matchesWithMask, matchesWithPrefixMask, toHexString, toNormalizedString, toNormalizedStringcontainsPrefixBlock, containsSinglePrefixBlock, getBlockMaskPrefixLength, getDivisionPrefixLength, getLeadingBitCount, getPrefixAdjustedRangeString, getString, getTrailingBitCount, getWildcardString, isPrefixed, isSinglePrefixBlock, matchesWithPrefixMaskbitwiseOrRange, getCount, getDigitCount, getDivisionPrefixCount, getMaxDigitCount, getPrefixCount, getPrefixLengthForSingleBlock, getUpperValue, getValue, hasUppercaseVariations, isBitwiseOrCompatibleWithRange, isMaskCompatibleWithRange, isMax, isZero, maskRange, matches, matchesWithMask, matchesWithMaskgetBytes, getBytes, getBytes, getDigitCount, getLowerStandardString, getStandardString, getUpperBytes, getUpperBytes, getUpperBytes, toStringcompareTo, containsPrefixBlock, containsSinglePrefixBlock, getBytes, getBytes, getBytes, getCount, getPrefixCount, getPrefixLengthForSingleBlock, getUpperBytes, getUpperBytes, getUpperBytes, getUpperValue, getValue, isFullRange, isMax, isZero, testRange, testRangegetDigitCount, getLowerStandardString, getMaxDigitCount, getStandardStringisFullRangepublic static final int MAX_CHARS
public static final int BITS_PER_CHAR
public IPv6AddressSegment(int value)
throws AddressValueException
value - the value of the segmentAddressValueException - if value is negative or too largepublic IPv6AddressSegment(int value,
java.lang.Integer segmentPrefixLength)
throws AddressValueException
value - the value of the segment. If the segmentPrefixLength is non-null, the network prefix of the value is used, and the segment represents all segment values with the same network prefix.segmentPrefixLength - the segment prefix length, which can be nullAddressValueException - if value or prefix length is negative or too largepublic IPv6AddressSegment(int lower,
int upper,
java.lang.Integer segmentPrefixLength)
throws AddressValueException
segmentPrefixLength - the segment prefix length, which can be null. If segmentPrefixLength is non-null, this segment represents a range of segment values with the given network prefix length.lower - the lower value of the range of values represented by the segment. If segmentPrefixLength is non-null, the lower value becomes the smallest value with the same network prefix.upper - the upper value of the range of values represented by the segment. If segmentPrefixLength is non-null, the upper value becomes the largest value with the same network prefix.AddressValueException - if value or prefix length is negative or too largepublic long getMaxValue()
getMaxValue in class IPAddressSegmentpublic boolean isIPv6()
isIPv6 in class IPAddressSegmentpublic IPAddress.IPVersion getIPVersion()
getIPVersion in class IPAddressSegmentpublic IPv6AddressNetwork getNetwork()
getNetwork in interface AddressSegmentgetNetwork in class IPAddressSegmentpublic int getMaxSegmentValue()
AddressSegmentAddressSegment.getUpper()getMaxSegmentValue in interface AddressSegmentpublic IPv6AddressSegment toNetworkSegment(java.lang.Integer segmentPrefixLength)
IPAddressSegmentIPAddressSegmentSeries.getNetworkSection(int, boolean)toNetworkSegment in class IPAddressSegmentpublic IPv6AddressSegment toNetworkSegment(java.lang.Integer segmentPrefixLength, boolean withPrefixLength)
IPAddressSegmentIPAddressSegmentSeries.getNetworkSection(int, boolean)toNetworkSegment in class IPAddressSegmentpublic IPv6AddressSegment toHostSegment(java.lang.Integer bits)
IPAddressSegmentIPAddressSegmentSeries.getHostSection(int)toHostSegment in class IPAddressSegmentpublic IPv6AddressSegment getLower()
IPAddressSegmentgetLower in interface AddressComponentgetLower in interface AddressSegmentgetLower in interface AddressItemRangegetLower in class IPAddressSegmentpublic IPv6AddressSegment getUpper()
IPAddressSegmentgetUpper in interface AddressComponentgetUpper in interface AddressSegmentgetUpper in interface AddressItemRangegetUpper in class IPAddressSegmentpublic IPv6AddressSegment reverseBits(boolean perByte)
AddressComponentIncompatibleAddressException. In a range the most significant bits stay constant
while the least significant bits range over different values, so reversing that scenario results in a series of non-consecutive values, in most cases,
which cannot be represented with a single AddressComponent object.
In such cases where isMultiple() is true, call iterator(), getLower(), getUpper() or some other methods to break the series down into a series representing a single value.
reverseBits in interface AddressComponentreverseBits in interface AddressSegmentreverseBits in class IPAddressSegmentperByte - if true, only the bits in each byte are reversed, if false, then all bits in the component are reversedpublic IPv6AddressSegment reverseBytes()
AddressComponentIncompatibleAddressException. In a range the most significant bits stay constant
while the least significant bits range over different values, so reversing that scenario results in a series of non-consecutive values, in most cases,
which cannot be represented with a single AddressComponent object.
In such cases where isMultiple() is true, call iterator(), getLower(), getUpper() or some other methods to break the series down into a series representing a single value.
reverseBytes in interface AddressComponentreverseBytes in interface AddressSegmentreverseBytes in class IPAddressSegmentpublic IPv6AddressSegment removePrefixLength(boolean zeroed)
removePrefixLength in class IPAddressSegmentpublic IPv6AddressSegment removePrefixLength()
removePrefixLength in class IPAddressSegmentpublic IPv6AddressSegment withoutPrefixLength()
withoutPrefixLength in class IPAddressSegmentpublic java.lang.Iterable<IPv6AddressSegment> getIterable()
AddressItemRangeAddressItemRange.iterator() directly.getIterable in interface AddressComponentgetIterable in interface AddressSegmentgetIterable in interface AddressItemRangegetIterable in class IPAddressSegmentpublic java.util.Iterator<IPv6AddressSegment> iterator()
AddressComponentAn address component can represent a single 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.
iterator in interface AddressComponentiterator in interface AddressSegmentiterator in interface AddressItemRangeiterator in interface java.lang.Iterable<IPv6AddressSegment>iterator in class IPAddressSegmentpublic java.util.Iterator<IPv6AddressSegment> prefixBlockIterator()
IPAddressSegment
If the series has no prefix length, then this is equivalent to IPAddressSegment.iterator()
prefixBlockIterator in class IPAddressSegmentpublic java.util.Iterator<IPv6AddressSegment> prefixBlockIterator(int prefixLength)
IPAddressSegmentprefixBlockIterator in class IPAddressSegmentpublic java.util.Iterator<IPv6AddressSegment> prefixIterator()
IPAddressSegment
If the series has no prefix length, then this is equivalent to IPAddressSegment.iterator()
prefixIterator in class IPAddressSegmentpublic int getBitCount()
AddressItemgetBitCount in interface AddressItemgetBitCount in interface IPAddressStringDivisionpublic int getByteCount()
AddressItemgetByteCount in interface AddressItempublic int getDefaultTextualRadix()
public int getMaxDigitCount()
public <S extends AddressSegment> void getSplitSegments(S[] segs, int index, AddressNetwork.AddressSegmentCreator<S> creator)
segs - index - public boolean prefixEquals(IPAddressSegment other)
prefixEquals in class IPAddressSegmentpublic boolean prefixEquals(AddressSegment other, int segmentPrefixLength)
prefixEquals in interface AddressSegmentprefixEquals in class IPAddressSegmentpublic boolean contains(AddressSegment other)
contains in interface AddressSegmentpublic boolean equals(java.lang.Object other)
AddressDivisionBaseequals in interface AddressSegmentequals in class AddressDivision