public class IPv6AddressSegment extends IPAddressSegment implements java.lang.Iterable<IPv6AddressSegment>
Modifier and Type | Field and Description |
---|---|
static int |
MAX_CHARS |
ADJUST_RANGES_BY_PREFIX
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) |
int |
getBitCount() |
int |
getByteCount()
returns the number of bytes in each of the address components represented by this instance
|
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() |
<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()
An address component can represent a single segment, address, or section, or it can represent multiple,
typically a subnet or range of segment, address, or section values.
|
static IPv6AddressSegment |
join(IPv4AddressSegment one,
IPv4AddressSegment two,
int upperRangeLower,
int upperRangeUpper,
int lowerRangeLower,
int lowerRangeUpper,
java.lang.Integer segmentPrefixLength) |
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.
|
IPv4AddressSegment[] |
split()
Splits this IPv6 address segment into one-byte segments
|
IPv6AddressSegment |
toHostSegment(java.lang.Integer bits)
used by getHostSection, see
IPAddress.getHostSection(int) |
IPv6AddressSegment |
toMaskedSegment(IPAddressSegment maskSegment,
java.lang.Integer segmentPrefixLength)
returns a new segment masked by the given mask
This method applies the mask first to every address in the range, and it does not preserve any existing prefix.
|
IPv6AddressSegment |
toNetworkSegment(java.lang.Integer segmentPrefixLength)
used by constructors of IPAddressSection, see
IPAddress.getNetworkSection(int, boolean) |
IPv6AddressSegment |
toNetworkSegment(java.lang.Integer segmentPrefixLength,
boolean withPrefixLength)
used by getNetworkSection and by constructors of IPAddressSection, see
IPAddress.getNetworkSection(int, boolean) |
getBitCount, getByteCount, getDefaultTextualRadix, getDivisionValueCount, getLowerSegmentValue, getLowerValue, getMaxSegmentValue, getMaxValue, getMinPrefix, getSegmentPrefixLength, getUpperSegmentValue, getUpperValue, getValueCount, hashCode, isBoundedBy, isFullRange, isFullRange, isFullRange, isIPv4, isMaskCompatibleWithRange, isMaskCompatibleWithRange, isMultiple, matches, matchesWithMask, matchesWithPrefix, toHexString, toNormalizedString, toNormalizedString
getConfiguredString, getDivisionPrefixLength, getMaskPrefixLength, getString, getWildcardString, isBitwiseOrCompatibleWithRange, isMaskCompatibleWithRange, isPrefixed, isRangeEquivalent, isRangeEquivalentToPrefix, isRangeUnchanged, isSamePrefixedRange, matchesWithPrefix
compareTo, getCount, getDigitCount, getMaxDigitCount, hasUppercaseVariations, isZero, matches, matchesWithMask
getBytes, getBytes, getDigitCount, getPrefixAdjustedString, getStandardString, getUpperBytes, getUpperBytes, toString
getBytes, getBytes, getCount, getUpperBytes, getUpperBytes, isZero
public static final int MAX_CHARS
public IPv6AddressSegment(int value)
value
- the value of the segmentpublic IPv6AddressSegment(int value, java.lang.Integer segmentPrefixLength)
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 nullpublic IPv6AddressSegment(int lower, int upper, java.lang.Integer segmentPrefixLength)
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.public boolean isIPv6()
isIPv6
in class IPAddressSegment
public IPAddress.IPVersion getIPVersion()
getIPVersion
in class IPAddressSegment
public int getMaxSegmentValue()
AddressSegment
AddressSegment.getUpper()
getMaxSegmentValue
in interface AddressSegment
public IPv6AddressSegment toNetworkSegment(java.lang.Integer segmentPrefixLength)
IPAddressSegment
IPAddress.getNetworkSection(int, boolean)
toNetworkSegment
in class IPAddressSegment
public IPv6AddressSegment toNetworkSegment(java.lang.Integer segmentPrefixLength, boolean withPrefixLength)
IPAddressSegment
IPAddress.getNetworkSection(int, boolean)
toNetworkSegment
in class IPAddressSegment
public IPv6AddressSegment toHostSegment(java.lang.Integer bits)
IPAddressSegment
IPAddress.getHostSection(int)
toHostSegment
in class IPAddressSegment
public IPv6AddressSegment toMaskedSegment(IPAddressSegment maskSegment, java.lang.Integer segmentPrefixLength) throws AddressTypeException
IPAddressSegment
AddressTypeException
is thrown.
See IPAddress.applyPrefixLength(int)
,
IPAddress#apply(IPAddress, Integer)
,
IPAddress#isMaskCompatibleWithRange(IPAddress, Integer)
toMaskedSegment
in class IPAddressSegment
AddressTypeException
public IPv6AddressSegment getLower()
IPAddressSegment
getLower
in interface AddressComponent
getLower
in interface AddressSegment
getLower
in class IPAddressSegment
public IPv6AddressSegment getUpper()
IPAddressSegment
getUpper
in interface AddressComponent
getUpper
in interface AddressSegment
getUpper
in class IPAddressSegment
public IPv6AddressSegment reverseBits(boolean perByte)
AddressComponent
reverseBits
in interface AddressComponent
reverseBits
in interface AddressSegment
reverseBits
in class IPAddressSegment
perByte
- if true, only the bits in each byte are reversed, if false, then all bits in the component are reversedpublic IPv6AddressSegment reverseBytes()
AddressComponent
reverseBytes
in interface AddressComponent
reverseBytes
in interface AddressSegment
reverseBytes
in class IPAddressSegment
public IPv6AddressSegment removePrefixLength(boolean zeroed)
removePrefixLength
in class IPAddressSegment
public IPv6AddressSegment removePrefixLength()
removePrefixLength
in class IPAddressSegment
public java.lang.Iterable<IPv6AddressSegment> getIterable()
AddressComponent
AddressComponent.iterator()
directly.getIterable
in interface AddressComponent
getIterable
in interface AddressSegment
getIterable
in class IPAddressSegment
public java.util.Iterator<IPv6AddressSegment> iterator()
AddressComponent
AddressItem.isMultiple()
to determine if this instance represents multiple.
This method iterates through the individual elements.iterator
in interface AddressComponent
iterator
in interface AddressSegment
iterator
in interface java.lang.Iterable<IPv6AddressSegment>
iterator
in class IPAddressSegment
public int getBitCount()
getBitCount
in interface AddressItem
public int getByteCount()
AddressComponent
getByteCount
in interface AddressComponent
public int getDefaultTextualRadix()
getDefaultTextualRadix
in class AddressDivisionBase
public int getMaxDigitCount()
getMaxDigitCount
in class AddressDivisionBase
public <S extends AddressSegment> void getSplitSegments(S[] segs, int index, AddressNetwork.AddressSegmentCreator<S> creator)
segs
- index
- public IPv4AddressSegment[] split()
public static IPv6AddressSegment join(IPv4AddressSegment one, IPv4AddressSegment two, int upperRangeLower, int upperRangeUpper, int lowerRangeLower, int lowerRangeUpper, java.lang.Integer segmentPrefixLength) throws AddressTypeException
AddressTypeException
public boolean contains(AddressSegment other)
contains
in interface AddressSegment
contains
in class IPAddressSegment
public boolean equals(java.lang.Object other)
equals
in interface AddressSegment
equals
in class java.lang.Object