public interface AddressComponent extends AddressItemRange
| Modifier and Type | Method and Description |
|---|---|
java.lang.Iterable<? extends AddressComponent> |
getIterable()
Useful for using an instance in a "for-each loop".
|
AddressComponent |
getLower()
If this instance represents multiple address items, returns the one with the lowest numeric value.
|
AddressComponent |
getUpper()
If this instance represents multiple address items, returns the one with the highest numeric value.
|
java.util.Iterator<? extends AddressComponent> |
iterator()
Iterates through the individual elements of this address component.
|
AddressComponent |
reverseBits(boolean perByte)
Returns a new AddressComponent with the bits reversed.
|
AddressComponent |
reverseBytes()
Returns an AddressComponent with the bytes reversed.
|
java.lang.String |
toHexString(boolean with0xPrefix)
Writes this address component as a single hexadecimal value with always the exact same number of characters, with or without a preceding 0x prefix.
|
java.lang.String |
toNormalizedString()
Produces a string that is consistent for all address components of the same type and version,
and is also similar to the canonical string
AddressSegmentSeries.toCanonicalString() in AddressComponent instances that are also AddressSegmentSeries instances. |
compareTo, containsPrefixBlock, containsSinglePrefixBlock, getBitCount, getByteCount, getBytes, getBytes, getBytes, getCount, getMinPrefixLengthForBlock, getPrefixCount, getPrefixLengthForSingleBlock, getUpperBytes, getUpperBytes, getUpperBytes, getUpperValue, getValue, includesMax, includesZero, isFullRange, isMax, isMultiple, isZero, testRange, testRangejava.lang.String toHexString(boolean with0xPrefix)
throws IncompatibleAddressException
If this component represents a range of values outside of the network prefix length, then this is printed as a range of two hex values.
For instance, for IPv4 addresses there are 8 hex characters, for IPv6 addresses there are 32 hex characters.
IncompatibleAddressExceptionjava.lang.String toNormalizedString()
AddressSegmentSeries.toCanonicalString() in AddressComponent instances that are also AddressSegmentSeries instances.AddressComponent reverseBits(boolean perByte)
IncompatibleAddressException. 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.
perByte - if true, only the bits in each byte are reversed, if false, then all bits in the component are reversedIncompatibleAddressException - when subnet addresses cannot be reversedAddressComponent reverseBytes()
IncompatibleAddressException. 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.
IncompatibleAddressException - when subnet addresses cannot be reversedAddressComponent getLower()
AddressItemRangegetLower in interface AddressItemRangeAddressComponent getUpper()
AddressItemRangegetUpper in interface AddressItemRangejava.lang.Iterable<? extends AddressComponent> getIterable()
AddressItemRangeAddressItemRange.iterator() directly.getIterable in interface AddressItemRangejava.util.Iterator<? extends AddressComponent> iterator()
An 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 AddressItemRange