- All Superinterfaces:
AddressComponentRange
,AddressItem
,AddressItemRange
,Comparable<AddressItem>
,Serializable
- All Known Subinterfaces:
AddressSection
,AddressSegment
,AddressSegmentSeries
,IPAddressSegmentSeries
- All Known Implementing Classes:
Address
,IPAddress
,IPAddressSection
,IPAddressSegment
,IPv4Address
,IPv4AddressSection
,IPv4AddressSegment
,IPv6Address
,IPv6AddressSection
,IPv6AddressSegment
,MACAddress
,MACAddressSection
,MACAddressSegment
-
Method Summary
Modifier and TypeMethodDescriptionReturns the network object for components of the same version (eg IPv4, IPv6 and MAC each have their own network object)reverseBits
(boolean perByte) Returns a new AddressComponent with the bits reversed.Returns an AddressComponent with the bytes reversed.AddressComponentSpliterator
<? extends AddressComponent> Partitions and traverses through the individual address components.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.Produces a string that is consistent for all address components of the same type and version, and is also similar to the canonical stringAddressSegmentSeries.toCanonicalString()
inAddressComponent
instances that are alsoAddressSegmentSeries
instances.Methods inherited from interface inet.ipaddr.format.AddressComponentRange
getIterable, getLower, getUpper, iterator, stream
Methods inherited from interface inet.ipaddr.format.AddressItem
compareTo, containsPrefixBlock, containsSinglePrefixBlock, getBitCount, getByteCount, getBytes, getBytes, getBytes, getCount, getMinPrefixLengthForBlock, getPrefixCount, getPrefixLengthForSingleBlock, getUpperBytes, getUpperBytes, getUpperBytes, getUpperValue, getValue, includesMax, includesZero, isFullRange, isMax, isMultiple, isZero
-
Method Details
-
getNetwork
AddressNetwork<?> getNetwork()Returns the network object for components of the same version (eg IPv4, IPv6 and MAC each have their own network object)- Returns:
-
toHexString
Writes this address component as a single hexadecimal value with always the exact same number of characters, with or without a preceding 0x prefix.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.
- Throws:
IncompatibleAddressException
-
toNormalizedString
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 stringAddressSegmentSeries.toCanonicalString()
inAddressComponent
instances that are alsoAddressSegmentSeries
instances.- Returns:
-
reverseBits
Returns a new AddressComponent with the bits reversed. If this component represents a range of values that cannot be reversed, then this throwsIncompatibleAddressException
. 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.
- Parameters:
perByte
- if true, only the bits in each byte are reversed, if false, then all bits in the component are reversed- Returns:
- Throws:
IncompatibleAddressException
- when subnet addresses cannot be reversed
-
reverseBytes
AddressComponent reverseBytes()Returns an AddressComponent with the bytes reversed. If this component represents a range of values that cannot be reversed, then this throwsIncompatibleAddressException
. 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.
- Returns:
- Throws:
IncompatibleAddressException
- when subnet addresses cannot be reversed
-
spliterator
AddressComponentSpliterator<? extends AddressComponent> spliterator()Description copied from interface:AddressComponentRange
Partitions and traverses through the individual address components.- Specified by:
spliterator
in interfaceAddressComponentRange
- Returns:
-