- All Implemented Interfaces:
AddressComponent
,AddressSegmentSeries
,AddressComponentRange
,AddressDivisionSeries
,AddressItem
,AddressItemRange
,AddressStringDivisionSeries
,Serializable
,Comparable<AddressItem>
- Direct Known Subclasses:
IPAddress
,MACAddress
To construct one from a String
use
IPAddressString
or MACAddressString
- Author:
- sfoley
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
static interface
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final AddressComparator
static final AddressComparator
static final char
static final String
static final String
static final AddressComparator
static final String
static final String
static final char
static final String
static final char
static final String
static final char
static final String
static final char
static final String
-
Method Summary
Modifier and TypeMethodDescriptionabstract Address
adjustPrefixBySegment
(boolean nextSegment) Increases or decreases prefix length to the next segment boundary.abstract Address
adjustPrefixBySegment
(boolean nextSegment, boolean zeroed) Increases or decreases prefix length to the next segment boundary.abstract Address
adjustPrefixLength
(int adjustment) Increases or decreases prefix length by the given increment.abstract Address
adjustPrefixLength
(int adjustment, boolean zeroed) Increases or decreases prefix length by the given increment.abstract Address
applyPrefixLength
(int networkPrefixLength) Deprecated.boolean
Returns whether this is same type and version of the given address and whether it contains all values in the given address or subnetboolean
containsPrefixBlock
(int prefixLength) Returns whether the values of this series contains the prefix block for the given prefix length.boolean
containsSinglePrefixBlock
(int prefixLength) Returns whether the values of this series contains a single prefix block for the given prefix length.static IPv4AddressNetwork
static IPv6AddressNetwork
static MACAddressNetwork
boolean
Two Address objects are equal if they represent the same set of addresses.int
Provides the number of bits comprising this address itemgetBlockCount
(int segmentCount) Returns the count of values in the initial (higher) count of divisions.int
Provides the number of bytes required for this address item, rounding up if the bit count is not a multiple of 8byte[]
getBytes()
byte[]
getBytes
(byte[] bytes) Copies the bytes of the lowest address item represented by this address item into the supplied array, and returns that array.byte[]
getBytes
(byte[] bytes, int index) Copies the bytes of the lowest address item represented by this address item into the supplied array starting at the given index, and returns that array.getCount()
Gets the count of addresses that this address may represent.int
String[]
Get standard-format strings for each of the divisions in the series.Useful for using an instance in a "for-each loop".abstract Address
getLower()
If this represents a series with ranging values, returns a series representing the lower values of the range.int
Returns the smallest prefix length possible such that this includes the block of addresses for that prefix.If this has a prefix length, the count of the range of values in the prefix.getPrefixCount
(int prefixLength) Gets the count of prefixes in this address for the given prefix length.the largest number of high bits for which this address represents all addresses with the same set of high bitsReturns a prefix length for which the range of this address subnet matches the block of addresses for that prefix.Gets the subsection from the series that comprises all segmentsint
Returns the number of segments in this series.void
getSegments
(int start, int end, AddressSegment[] segs, int index) get the segments from start to end and insert into the segs array at the given indexvoid
getSegments
(AddressSegment[] segs) Copies the existing segments into the given array.String[]
Returns the an array with the values of each segment as they would appear in the normalized with wildcards string.abstract Address
getUpper()
If this represents a series with ranging values, returns a series representing the upper values of the range If this represents a series with a single value in each segment, returns this.byte[]
Gets the bytes for the highest address in the range of addresses represented by this address instance.byte[]
getUpperBytes
(byte[] bytes) Copies the bytes of the largest address item represented by this address item into the supplied array, and returns that array.byte[]
getUpperBytes
(byte[] bytes, int index) Copies the bytes of the largest address item represented by this address item into the supplied array at the given index, and returns that array.Returns the highest value represented by this address item, the highest value included in the range of valuesgetValue()
Returns the lowest value represented by this address item, the lowest value included in the range of valuesint
hashCode()
boolean
Returns whether this item includes the maximum possible value for the address type or version within its rangeboolean
Returns whether this item includes the value of zero within its rangeabstract Address
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.abstract Address
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.boolean
whether this address item represents all possible values attainable by an address item of this typeabstract boolean
isLocal()
Whether the address can be considered a local address (as opposed to a global one)boolean
isMax()
Returns whether this item matches the maximum possible value for the address type or versionint
isMore
(AddressDivisionSeries other) Use this method to compare the counts of two address series.abstract boolean
Whether the MAC address or IP address or other form of address is multicast.boolean
Returns whether this address represents more than a single individual address, whether it is a subnet.boolean
Returns whether the address range has a prefix length and includes the block of values for its prefix length.boolean
Returns whether this address has an associated prefix lengthboolean
isSameAddress
(Address other) boolean
Returns whether the series represents a range of values that are sequential.boolean
Returns whether the address range the block of values for a single prefix identified by its prefix length.boolean
isZero()
Returns whether this item matches the value of zeroiterator()
Iterates through the individual address components.Iterates through the individual prefix blocks.abstract AddressComponentSpliterator
<? extends Address> Partitions and traverses through the individual prefix blocks for the prefix length of this series.Returns a sequential stream of the individual prefix blocks for the prefix length of this series.boolean
prefixEquals
(Address other) Iterates through the individual prefixes.abstract AddressComponentSpliterator
<? extends Address> Partitions and traverses through the individual prefixes for the prefix length of this series.Returns a sequential stream of the individual prefixes for the prefix length of this series.abstract Address
Deprecated.abstract Address
removePrefixLength
(boolean zeroed) Deprecated.abstract Address
reverseBits
(boolean perByte) Returns a new segment series with the bits reversed.abstract Address
Returns a new segment series with the bytes reversed.abstract Address
Returns a new segment series with the bytes reversed within each segment.abstract Address
Returns a new segment series with the segments reversed.abstract Address
setPrefixLength
(int prefixLength) Sets the prefix length.abstract Address
setPrefixLength
(int prefixLength, boolean zeroed) Sets the prefix length.abstract AddressComponentSpliterator
<? extends Address> Partitions and traverses through the individual address components.stream()
Returns a sequential stream of the individual address components.Returns a host identifier string representation for this address, which will be already validated.This produces a canonical string.Produce short strings for the address in the usual address format.toHexString
(boolean with0xPrefix) Writes this address as a single hexadecimal value with always the exact same number of characters, with or without a preceding 0x prefix.The normalized string returned by this method is a common and consistent representation of the address.abstract Address
If this series has a prefix length, returns the block for that prefix.toString()
abstract Address
Provides the same address with no prefix.Methods inherited from interface inet.ipaddr.AddressComponent
getNetwork
Methods inherited from interface inet.ipaddr.format.AddressDivisionSeries
getDivision, getSequentialBlockIndex
Methods inherited from interface inet.ipaddr.format.AddressItem
compareTo
Methods inherited from interface inet.ipaddr.AddressSegmentSeries
getBitsPerSegment, getBytesPerSegment, getMaxSegmentValue, getSection, getSection, getSegment, getSegments, isOneBit, segmentsIterator, segmentsSpliterator, segmentsStream, testBit
-
Field Details
-
HEX_PREFIX
- See Also:
-
OCTAL_PREFIX
- See Also:
-
RANGE_SEPARATOR
public static final char RANGE_SEPARATOR- See Also:
-
RANGE_SEPARATOR_STR
-
ALTERNATIVE_RANGE_SEPARATOR
public static final char ALTERNATIVE_RANGE_SEPARATOR- See Also:
-
ALTERNATIVE_RANGE_SEPARATOR_STR
-
SEGMENT_WILDCARD
public static final char SEGMENT_WILDCARD- See Also:
-
SEGMENT_WILDCARD_STR
-
ALTERNATIVE_SEGMENT_WILDCARD_STR
- See Also:
-
SEGMENT_SQL_WILDCARD
public static final char SEGMENT_SQL_WILDCARD- See Also:
-
SEGMENT_SQL_WILDCARD_STR
-
SEGMENT_SQL_SINGLE_WILDCARD
public static final char SEGMENT_SQL_SINGLE_WILDCARD- See Also:
-
SEGMENT_SQL_SINGLE_WILDCARD_STR
-
DEFAULT_ADDRESS_COMPARATOR
-
ADDRESS_LOW_VALUE_COMPARATOR
-
ADDRESS_HIGH_VALUE_COMPARATOR
-
-
Method Details
-
defaultIpv6Network
-
defaultIpv4Network
-
defaultMACNetwork
-
getSegmentCount
public int getSegmentCount()Description copied from interface:AddressSegmentSeries
Returns the number of segments in this series.- Specified by:
getSegmentCount
in interfaceAddressSegmentSeries
- Returns:
-
getDivisionCount
public int getDivisionCount()- Specified by:
getDivisionCount
in interfaceAddressStringDivisionSeries
-
getBitCount
public int getBitCount()Description copied from interface:AddressItem
Provides the number of bits comprising this address item- Specified by:
getBitCount
in interfaceAddressDivisionSeries
- Specified by:
getBitCount
in interfaceAddressItem
- Returns:
- the number of bits
-
getByteCount
public int getByteCount()Description copied from interface:AddressItem
Provides the number of bytes required for this address item, rounding up if the bit count is not a multiple of 8- Specified by:
getByteCount
in interfaceAddressItem
- Returns:
- the number of bytes
-
getSection
Description copied from interface:AddressSegmentSeries
Gets the subsection from the series that comprises all segments- Specified by:
getSection
in interfaceAddressSegmentSeries
- Returns:
-
getSegments
Description copied from interface:AddressSegmentSeries
Copies the existing segments into the given array. The array size should be at least as large asAddressSegmentSeries.getSegmentCount()
- Specified by:
getSegments
in interfaceAddressSegmentSeries
-
getSegments
Description copied from interface:AddressSegmentSeries
get the segments from start to end and insert into the segs array at the given index- Specified by:
getSegments
in interfaceAddressSegmentSeries
- Parameters:
start
- the first segment index from this series to be includedend
- the first segment index to be excludedsegs
- the target arrayindex
- where to insert the segments in the segs array
-
getIterable
Description copied from interface:AddressComponentRange
Useful for using an instance in a "for-each loop". Otherwise just callAddressComponentRange.iterator()
directly.- Specified by:
getIterable
in interfaceAddressComponentRange
- Specified by:
getIterable
in interfaceAddressSegmentSeries
- Returns:
-
iterator
Description copied from interface:AddressComponentRange
Iterates through the individual address components.An 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, orAddressItem.getCount()
for the count.- Specified by:
iterator
in interfaceAddressComponentRange
- Specified by:
iterator
in interfaceAddressSegmentSeries
- Returns:
-
spliterator
Description copied from interface:AddressComponentRange
Partitions and traverses through the individual address components.- Specified by:
spliterator
in interfaceAddressComponent
- Specified by:
spliterator
in interfaceAddressComponentRange
- Specified by:
spliterator
in interfaceAddressSegmentSeries
- Returns:
-
stream
Description copied from interface:AddressComponentRange
Returns a sequential stream of the individual address components. For a parallel stream, callBaseStream.parallel()
on the returned stream.- Specified by:
stream
in interfaceAddressComponentRange
- Specified by:
stream
in interfaceAddressSegmentSeries
- Returns:
-
prefixIterator
Description copied from interface:AddressSegmentSeries
Iterates through the individual prefixes.If the series has no prefix length, then this is equivalent to
AddressSegmentSeries.iterator()
- Specified by:
prefixIterator
in interfaceAddressSegmentSeries
-
prefixSpliterator
Description copied from interface:AddressSegmentSeries
Partitions and traverses through the individual prefixes for the prefix length of this series.- Specified by:
prefixSpliterator
in interfaceAddressSegmentSeries
- Returns:
-
prefixStream
Description copied from interface:AddressSegmentSeries
Returns a sequential stream of the individual prefixes for the prefix length of this series. For a parallel stream, callBaseStream.parallel()
on the returned stream.- Specified by:
prefixStream
in interfaceAddressSegmentSeries
- Returns:
-
prefixBlockIterator
Description copied from interface:AddressSegmentSeries
Iterates through the individual prefix blocks.If the series has no prefix length, then this is equivalent to
AddressSegmentSeries.iterator()
- Specified by:
prefixBlockIterator
in interfaceAddressSegmentSeries
-
prefixBlockSpliterator
Description copied from interface:AddressSegmentSeries
Partitions and traverses through the individual prefix blocks for the prefix length of this series.- Specified by:
prefixBlockSpliterator
in interfaceAddressSegmentSeries
- Returns:
-
prefixBlockStream
Description copied from interface:AddressSegmentSeries
Returns a sequential stream of the individual prefix blocks for the prefix length of this series. For a parallel stream, callBaseStream.parallel()
on the returned stream.- Specified by:
prefixBlockStream
in interfaceAddressSegmentSeries
- Returns:
-
increment
Description copied from interface:AddressSegmentSeries
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.If 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.
- Specified by:
increment
in interfaceAddressSegmentSeries
- Parameters:
increment
-- Returns:
- Throws:
AddressValueException
- in case of underflow or overflow
-
incrementBoundary
Description copied from interface:AddressSegmentSeries
If the given increment is positive, adds the value to the upper series (AddressSegmentSeries.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.
- Specified by:
incrementBoundary
in interfaceAddressSegmentSeries
- Parameters:
increment
-- Returns:
- Throws:
AddressValueException
- in case of underflow or overflow
-
getLower
Description copied from interface:AddressSegmentSeries
If this represents a series with ranging values, returns a series representing the lower values of the range. If this represents an series with a single value in each segment, returns this.- Specified by:
getLower
in interfaceAddressComponentRange
- Specified by:
getLower
in interfaceAddressSegmentSeries
- Returns:
-
getUpper
Description copied from interface:AddressSegmentSeries
If this represents a series with ranging values, returns a series representing the upper values of the range If this represents a series with a single value in each segment, returns this.- Specified by:
getUpper
in interfaceAddressComponentRange
- Specified by:
getUpper
in interfaceAddressSegmentSeries
- Returns:
-
isMultiple
public boolean isMultiple()Returns whether this address represents more than a single individual address, whether it is a subnet. Such addresses include CIDR/IP addresses (eg 1.2.3.0/25) or wildcard addresses (eg 1.2.*.4) or range addresses (eg 1.2.3-4.5)- Specified by:
isMultiple
in interfaceAddressItem
- Returns:
- whether this address represents more than one address.
-
isPrefixed
public boolean isPrefixed()Returns whether this address has an associated prefix length- Specified by:
isPrefixed
in interfaceAddressDivisionSeries
- Returns:
- whether this address has an associated prefix length
-
getPrefixLength
the largest number of high bits for which this address represents all addresses with the same set of high bits- Specified by:
getPrefixLength
in interfaceAddressDivisionSeries
-
getMinPrefixLengthForBlock
public int getMinPrefixLengthForBlock()Returns the smallest prefix length possible such that this includes the block of addresses for that prefix.If the entire range can be dictated this way, then this method returns the same value as
getPrefixLengthForSingleBlock()
. Otherwise, this method will return the minimal possible prefix that can be paired with this address, whilegetPrefixLengthForSingleBlock()
will return null.In cases where the final bit in this address division series is constant, this returns the bit length of this address division series.
- Specified by:
getMinPrefixLengthForBlock
in interfaceAddressItem
- Returns:
- the prefix length
-
getPrefixLengthForSingleBlock
Returns a prefix length for which the range of this address subnet matches the block of addresses for that prefix.If the range can be dictated this way, then this method returns the same value as
getMinPrefixLengthForBlock()
.If no such prefix exists, returns null.
If this segment grouping represents a single value, returns the bit length of this address division series.
IP address examples: 1.2.3.4 returns 32 1.2.*.* returns 16 1.2.*.0/24 returns 16 in the case of PrefixConfiguration == ALL_PREFIXES_ARE_SUBNETS, 32 otherwise 1.2.*.4 returns null 1.2.252-255.* returns 22 1.2.3.4/x returns x in the case of PrefixConfiguration == ALL_PREFIXES_ARE_SUBNETS, 32 otherwise 1.2.0.0/16 returns 16 in the case of PrefixConfiguration == ALL_PREFIXES_ARE_SUBNETS or PREFIXED_ZERO_HOSTS_ARE_SUBNETS, 32 otherwise
- Specified by:
getPrefixLengthForSingleBlock
in interfaceAddressItem
- Returns:
- the prefix length or null if it does not exist
-
isMulticast
public abstract boolean isMulticast()Whether the MAC address or IP address or other form of address is multicast.- See Also:
-
getCount
Gets the count of addresses that this address may represent. If this address is not a subnet block of multiple addresses or has no range of values, then there is only one such address.- Specified by:
getCount
in interfaceAddressDivisionSeries
- Specified by:
getCount
in interfaceAddressItem
- Returns:
-
getPrefixCount
Gets the count of prefixes in this address for the given prefix length. If this address is not a subnet block of multiple addresses or has no range of values, then there is only one.- Specified by:
getPrefixCount
in interfaceAddressDivisionSeries
- Specified by:
getPrefixCount
in interfaceAddressItem
- Parameters:
prefixLength
-- Returns:
-
getPrefixCount
If this has a prefix length, the count of the range of values in the prefix. If this has no prefix, returns the same value asgetCount()
- Specified by:
getPrefixCount
in interfaceAddressDivisionSeries
- Returns:
-
getBlockCount
Description copied from interface:AddressDivisionSeries
Returns the count of values in the initial (higher) count of divisions.- Specified by:
getBlockCount
in interfaceAddressDivisionSeries
- Returns:
-
isMore
Description copied from interface:AddressDivisionSeries
Use this method to compare the counts of two address series. Rather than calculating counts with getCount(), there can be more efficient ways of comparing whether one series represents more individual address series than another.- Specified by:
isMore
in interfaceAddressDivisionSeries
- Returns:
- a positive integer if this AddressDivisionSeries has a larger count than the provided, 0 if they are the same, a negative integer if the other has a larger count.
-
getBytes
public byte[] getBytes()- Specified by:
getBytes
in interfaceAddressItem
- Returns:
- the bytes of the lowest address item represented by this address item
-
getBytes
public byte[] getBytes(byte[] bytes) Description copied from interface:AddressItem
Copies the bytes of the lowest address item represented by this address item into the supplied array, and returns that array. If the supplied array is null or of insufficient size, a new array is created and returned.- Specified by:
getBytes
in interfaceAddressItem
- Returns:
- the bytes of the lowest address represented by this address item.
-
getBytes
public byte[] getBytes(byte[] bytes, int index) Description copied from interface:AddressItem
Copies the bytes of the lowest address item represented by this address item into the supplied array starting at the given index, and returns that array. If the supplied array is null or of insufficient size, a new array is created and returned, with the rest of the array contents the same as the original.- Specified by:
getBytes
in interfaceAddressItem
- Returns:
- the bytes of the lowest address represented by this address item.
-
getUpperBytes
public byte[] getUpperBytes()Gets the bytes for the highest address in the range of addresses represented by this address instance.- Specified by:
getUpperBytes
in interfaceAddressItem
- Returns:
-
getUpperBytes
public byte[] getUpperBytes(byte[] bytes) Description copied from interface:AddressItem
Copies the bytes of the largest address item represented by this address item into the supplied array, and returns that array. If the supplied array is null or of insufficient size, a new array is created and returned, with the rest of the array contents the same as the original.- Specified by:
getUpperBytes
in interfaceAddressItem
- Returns:
- the bytes of the largest address represented by this address item.
-
getUpperBytes
public byte[] getUpperBytes(byte[] bytes, int index) Description copied from interface:AddressItem
Copies the bytes of the largest address item represented by this address item into the supplied array at the given index, and returns that array. If the supplied array is null or of insufficient size, a new array is created and returned.- Specified by:
getUpperBytes
in interfaceAddressItem
- Returns:
- the bytes of the largest address represented by this address item.
-
getValue
Description copied from interface:AddressItem
Returns the lowest value represented by this address item, the lowest value included in the range of values- Specified by:
getValue
in interfaceAddressItem
- Returns:
- the lowest value represented by this address item
-
getUpperValue
Description copied from interface:AddressItem
Returns the highest value represented by this address item, the highest value included in the range of values- Specified by:
getUpperValue
in interfaceAddressItem
- Returns:
- the highest value represented by this address item
-
isZero
public boolean isZero()Description copied from interface:AddressItem
Returns whether this item matches the value of zero- Specified by:
isZero
in interfaceAddressItem
- Returns:
- whether this item matches the value of zero
-
includesZero
public boolean includesZero()Description copied from interface:AddressItem
Returns whether this item includes the value of zero within its range- Specified by:
includesZero
in interfaceAddressItem
- Returns:
- whether this item includes the value of zero within its range
-
isMax
public boolean isMax()Description copied from interface:AddressItem
Returns whether this item matches the maximum possible value for the address type or version- Specified by:
isMax
in interfaceAddressItem
- Returns:
- whether this item matches the maximum possible value
-
includesMax
public boolean includesMax()Description copied from interface:AddressItem
Returns whether this item includes the maximum possible value for the address type or version within its range- Specified by:
includesMax
in interfaceAddressItem
- Returns:
- whether this item includes the maximum possible value within its range
-
isFullRange
public boolean isFullRange()Description copied from interface:AddressItem
whether this address item represents all possible values attainable by an address item of this type- Specified by:
isFullRange
in interfaceAddressItem
- Returns:
- whether this address item represents all possible values attainable by an address item of this type, or in other words, both includesZero() and includesMax() return true
-
isLocal
public abstract boolean isLocal()Whether the address can be considered a local address (as opposed to a global one)- Returns:
-
hashCode
public int hashCode() -
isSameAddress
-
equals
Two Address objects are equal if they represent the same set of addresses. -
prefixEquals
-
contains
Returns whether this is same type and version of the given address and whether it contains all values in the given address or subnet- Parameters:
other
-- Returns:
-
isSequential
public boolean isSequential()Description copied from interface:AddressDivisionSeries
Returns whether the series represents a range of values that are sequential.Generally, this means that any division covering a range of values must be followed by divisions that are full range, covering all values.
- Specified by:
isSequential
in interfaceAddressDivisionSeries
- Returns:
-
toAddressString
Returns a host identifier string representation for this address, which will be already validated.- Returns:
-
toHexString
Writes this address as a single hexadecimal value with always the exact same number of characters, with or without a preceding 0x prefix. If this section represents a range of values outside of the network prefix length, then this is printed as a range of two hex values.- Specified by:
toHexString
in interfaceAddressComponent
- Throws:
IncompatibleAddressException
-
toNormalizedString
The normalized string returned by this method is a common and consistent representation of the address.The string returned by this method is unique for each address.
- Specified by:
toNormalizedString
in interfaceAddressComponent
- Returns:
-
toCanonicalString
This produces a canonical string.RFC 5952 describes canonical representations for Ipv6 http://en.wikipedia.org/wiki/IPv6_address#Recommended_representation_as_text http://tools.ietf.org/html/rfc5952
Each address has a unique canonical string, not counting the prefix. The prefix can cause two equal addresses to have different strings.
- Specified by:
toCanonicalString
in interfaceAddressSegmentSeries
- Returns:
-
toCompressedString
Produce short strings for the address in the usual address format. Each address has a unique compressed string.- Specified by:
toCompressedString
in interfaceAddressSegmentSeries
- Returns:
-
toString
-
getDivisionStrings
Description copied from interface:AddressDivisionSeries
Get standard-format strings for each of the divisions in the series.- Specified by:
getDivisionStrings
in interfaceAddressDivisionSeries
- Returns:
-
getSegmentStrings
Description copied from interface:AddressSegmentSeries
Returns the an array with the values of each segment as they would appear in the normalized with wildcards string.- Specified by:
getSegmentStrings
in interfaceAddressSegmentSeries
- Returns:
-
reverseSegments
Description copied from interface:AddressSegmentSeries
Returns a new segment series with the segments reversed. This does not throwIncompatibleAddressException
since all address series can reverse their segments.- Specified by:
reverseSegments
in interfaceAddressSegmentSeries
- Returns:
-
reverseBits
Description copied from interface:AddressSegmentSeries
Returns a new segment series with the bits reversed.- Specified by:
reverseBits
in interfaceAddressComponent
- Specified by:
reverseBits
in interfaceAddressSegmentSeries
- Parameters:
perByte
- if true, only the bits in each byte are reversed, if false, then all bits in the component are reversed- Returns:
-
reverseBytes
Description copied from interface:AddressSegmentSeries
Returns a new segment series with the bytes reversed.- Specified by:
reverseBytes
in interfaceAddressComponent
- Specified by:
reverseBytes
in interfaceAddressSegmentSeries
- Returns:
-
reverseBytesPerSegment
Description copied from interface:AddressSegmentSeries
Returns a new segment series with the bytes reversed within each segment.- Specified by:
reverseBytesPerSegment
in interfaceAddressSegmentSeries
- Returns:
-
isPrefixBlock
public boolean isPrefixBlock()Returns whether the address range has a prefix length and includes the block of values for its prefix length.- Specified by:
isPrefixBlock
in interfaceAddressDivisionSeries
- Returns:
-
containsPrefixBlock
public boolean containsPrefixBlock(int prefixLength) Description copied from interface:AddressItem
Returns whether the values of this series contains the prefix block for the given prefix length.Use
AddressItem.getMinPrefixLengthForBlock()
to determine the smallest prefix length for which this method returns true.- Specified by:
containsPrefixBlock
in interfaceAddressItem
- Parameters:
prefixLength
-- Returns:
-
isSinglePrefixBlock
public boolean isSinglePrefixBlock()Returns whether the address range the block of values for a single prefix identified by its prefix length. This is similar toisPrefixBlock()
except that it returns false when the subnet has multiple prefixes. For instance, 1.*.*.* /16 return false for this method and returns true forisPrefixBlock()
- Specified by:
isSinglePrefixBlock
in interfaceAddressDivisionSeries
- Returns:
-
containsSinglePrefixBlock
public boolean containsSinglePrefixBlock(int prefixLength) Description copied from interface:AddressItem
Returns whether the values of this series contains a single prefix block for the given prefix length.Use
AddressItem.getPrefixLengthForSingleBlock()
to determine whether there is a prefix length for which this method returns true.- Specified by:
containsSinglePrefixBlock
in interfaceAddressItem
- Parameters:
prefixLength
-- Returns:
-
toPrefixBlock
Description copied from interface:AddressSegmentSeries
If this series has a prefix length, returns the block for that prefix. Otherwise, this address series is returned.- Specified by:
toPrefixBlock
in interfaceAddressSegmentSeries
- Returns:
- the block of address series for the prefix length
-
removePrefixLength
Deprecated.Description copied from interface:AddressSegmentSeries
Removes the prefix length while zeroing out the bits beyond the prefix.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)
- Specified by:
removePrefixLength
in interfaceAddressSegmentSeries
- Returns:
- See Also:
-
withoutPrefixLength
Description copied from interface:AddressSegmentSeries
Provides the same address with no prefix. The values remain unchanged.Use
AddressSegmentSeries.removePrefixLength()
as an alternative that deletes the host at the same time by zeroing the host values.- Specified by:
withoutPrefixLength
in interfaceAddressSegmentSeries
-
removePrefixLength
Deprecated.Description copied from interface:AddressSegmentSeries
Removes the prefix length. If zeroed is false, the bits that were host bits do not become zero, unlikeAddressSegmentSeries.removePrefixLength()
- Specified by:
removePrefixLength
in interfaceAddressSegmentSeries
- Parameters:
zeroed
- whether the bits outside the prefix become zero- Returns:
-
adjustPrefixBySegment
Description copied from interface:AddressSegmentSeries
Increases or decreases prefix length to the next segment boundary.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, useAddressSegmentSeries.adjustPrefixBySegment(boolean, boolean)
with second arg false.- Specified by:
adjustPrefixBySegment
in interfaceAddressSegmentSeries
- Parameters:
nextSegment
- whether to move prefix to previous or following segment boundary- Returns:
-
adjustPrefixBySegment
Description copied from interface:AddressSegmentSeries
Increases or decreases prefix length to the next segment boundary.- Specified by:
adjustPrefixBySegment
in interfaceAddressSegmentSeries
- Parameters:
nextSegment
- 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 values- Returns:
-
adjustPrefixLength
Description copied from interface:AddressSegmentSeries
Increases or decreases prefix length by the given increment.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.- Specified by:
adjustPrefixLength
in interfaceAddressSegmentSeries
- Parameters:
adjustment
-- Returns:
-
adjustPrefixLength
Description copied from interface:AddressSegmentSeries
Increases or decreases prefix length by the given increment.- Specified by:
adjustPrefixLength
in interfaceAddressSegmentSeries
- Parameters:
adjustment
- the incrementzeroed
- whether the bits that move from one side of the prefix to the other become zero or retain their original values- Returns:
-
setPrefixLength
Description copied from interface:AddressSegmentSeries
Sets the prefix length.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.
- Specified by:
setPrefixLength
in interfaceAddressSegmentSeries
- Parameters:
prefixLength
-- Returns:
-
setPrefixLength
Description copied from interface:AddressSegmentSeries
Sets the prefix length.When the prefix is extended beyond the segment series boundary, it is removed.
- Specified by:
setPrefixLength
in interfaceAddressSegmentSeries
- Parameters:
zeroed
- 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.- Returns:
-
applyPrefixLength
Deprecated.Description copied from interface:AddressSegmentSeries
Applies the given prefix length to create a new segment series.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.
- Specified by:
applyPrefixLength
in interfaceAddressSegmentSeries
- Parameters:
networkPrefixLength
-- Returns:
- See Also:
-