public class IPv4AddressSection extends IPAddressSection implements Iterable<IPv4AddressSection>
Modifier and Type | Class and Description |
---|---|
static class |
IPv4AddressSection.IPv4StringBuilderOptions |
static class |
IPv4AddressSection.IPv4StringOptions
Represents a clear way to create a specific type of string.
|
IPAddressSection.IPStringBuilderOptions, IPAddressSection.IPStringOptions, IPAddressSection.SegFunction<R,S>, IPAddressSection.SeriesCreator, IPAddressSection.TriFunction<R,S>, IPAddressSection.WildcardOptions
IPAddressDivisionGrouping.Range, IPAddressDivisionGrouping.RangeList
AddressDivisionGrouping.DivisionLengthProvider, AddressDivisionGrouping.DivisionValueProvider, AddressDivisionGrouping.StringOptions
Constructor and Description |
---|
IPv4AddressSection(Address.SegmentValueProvider lowerValueProvider,
Address.SegmentValueProvider upperValueProvider,
int segmentCount) |
IPv4AddressSection(Address.SegmentValueProvider lowerValueProvider,
Address.SegmentValueProvider upperValueProvider,
int segmentCount,
Integer networkPrefixLength) |
IPv4AddressSection(Address.SegmentValueProvider valueProvider,
int segmentCount) |
IPv4AddressSection(Address.SegmentValueProvider valueProvider,
int segmentCount,
Integer networkPrefixLength) |
IPv4AddressSection(byte[] bytes) |
IPv4AddressSection(byte[] bytes,
Integer prefix) |
IPv4AddressSection(byte[] bytes,
int byteStartIndex,
int byteEndIndex) |
IPv4AddressSection(byte[] bytes,
int byteStartIndex,
int byteEndIndex,
Integer prefix) |
IPv4AddressSection(int value) |
IPv4AddressSection(int value,
Integer networkPrefixLength) |
IPv4AddressSection(IPv4AddressSegment segment)
Constructs a single segment section.
|
IPv4AddressSection(IPv4AddressSegment[] segments) |
IPv4AddressSection(IPv4AddressSegment[] segments,
Integer networkPrefixLength) |
Modifier and Type | Method and Description |
---|---|
IPv4AddressSection |
adjustPrefixBySegment(boolean nextSegment)
Increases or decreases prefix length to the next segment boundary.
|
IPv4AddressSection |
adjustPrefixBySegment(boolean nextSegment,
boolean zeroed)
Increases or decreases prefix length to the next segment boundary.
|
IPv4AddressSection |
adjustPrefixLength(int adjustment)
Increases or decreases prefix length by the given increment.
|
IPv4AddressSection |
adjustPrefixLength(int adjustment,
boolean zeroed)
Increases or decreases prefix length by the given increment.
|
IPv4AddressSection |
append(IPv4AddressSection other) |
IPv4AddressSection |
appendToNetwork(IPv4AddressSection other) |
IPv4AddressSection |
applyPrefixLength(int networkPrefixLength)
Deprecated.
|
IPv4AddressSection |
assignMinPrefixForBlock()
Constructs an equivalent address section with the smallest CIDR prefix possible (largest network),
such that the range of values are a set of subnet blocks for that prefix.
|
IPv4AddressSection |
assignPrefixForSingleBlock()
Returns the equivalent CIDR address section with a prefix length for which the subnet block for that prefix matches the range of values in this section.
|
IPv4AddressSection |
bitwiseOr(IPv4AddressSection mask)
Equivalent to
bitwiseOr(IPv4AddressSection, boolean) with the second argument as false. |
IPv4AddressSection |
bitwiseOr(IPv4AddressSection mask,
boolean retainPrefix)
Does the bitwise disjunction with this address section.
|
IPv4AddressSection |
bitwiseOrNetwork(IPv4AddressSection mask,
int networkPrefixLength)
Does the bitwise disjunction with this address section.
|
Iterator<IPv4AddressSection> |
blockIterator(int segmentCount)
Iterates through series that can be obtained by iterating through all the upper segments up to the given segment count.
|
AddressComponentSpliterator<IPv4AddressSection> |
blockSpliterator(int segmentCount)
Partitions and traverses through the individual sequential blocks created from each of the individual values up to the given segment count.
|
Stream<IPv4AddressSection> |
blockStream(int segmentCount)
Returns a sequential stream of the individual blocks created from each of the individual values up to the given segment count.
|
boolean |
contains(AddressSection other)
Determines if one section contains another.
|
IPv4AddressSection |
coverWithPrefixBlock()
Returns the minimal-size prefix block that covers all the values in this series.
|
IPv4AddressSection |
coverWithPrefixBlock(IPv4AddressSection other) |
IPv4AddressSection |
createMaxHost() |
BigInteger |
enumerate(AddressSection other)
Indicates where an address section sits relative to the ordering of individual address sections within this section.
|
Long |
enumerateIPv4(IPv4AddressSection other)
Indicates where an address section sits relative to the ordering of individual address sections within this section.
|
boolean |
equals(Object o)
Two groupings are equal if:
- they match type/version (ipv4, ipv6, mac, or a specific grouping class)
- they match division counts
- each division matches bit counts
- each division matches their specific grouping class
- each division matches values
Prefix lengths, for those groupings and/or divisionsS that have them, are ignored.
|
int |
getBitCount()
Provides the number of bits comprising this address item
|
int |
getBitsPerSegment()
Returns the number of bits comprising each segment in this series.
|
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 |
getBytesPerSegment()
Returns the number of bytes comprising each segment in this series.
|
IPv4AddressSegment |
getDivision(int index) |
IPv4AddressSection |
getHostMask()
Returns the host mask associated with the CIDR network prefix length of this series.
|
IPv4AddressSection |
getHostSection()
Returns the host section of the series.
|
IPv4AddressSection |
getHostSection(int networkPrefixLength)
Returns the host section of the address as indicated by the network prefix length provided.
|
long |
getIPv4Count(boolean excludeZeroHosts) |
long |
getIPv4PrefixCount() |
long |
getIPv4PrefixCount(int prefixLength) |
IPAddress.IPVersion |
getIPVersion()
Returns the version of this segment series
|
Iterable<IPv4AddressSection> |
getIterable()
Useful for using an instance in a "for-each loop".
|
IPv4AddressSection |
getLower()
If this represents a series with ranging values, returns a series representing the lower values of the range.
|
IPv4AddressSection |
getLowerNonZeroHost()
Similar to
IPAddressSegmentSeries.getLower() , but will not return a series that has a prefix length and whose host value is zero. |
IPv4AddressNetwork |
getNetwork()
Returns the network object for components of the same version (eg IPv4, IPv6 and MAC each have their own network object)
|
IPv4AddressSection |
getNetworkMask()
Returns the network mask associated with the CIDR network prefix length of this series.
|
IPv4AddressSection |
getNetworkSection()
Returns the network section of the series if the series has a CIDR network prefix length,
otherwise it returns the entire series as a prefixed series with prefix matching the address bit length.
|
IPv4AddressSection |
getNetworkSection(int networkPrefixLength)
Returns the network section of the series.
|
IPv4AddressSection |
getNetworkSection(int networkPrefixLength,
boolean withPrefixLength)
Returns the network section of the series.
|
IPAddressStringDivisionSeries[] |
getParts(IPAddressSection.IPStringBuilderOptions options)
Get all representations of this address including this IPAddressSection.
|
IPAddressStringDivisionSeries[] |
getParts(IPv4AddressSection.IPv4StringBuilderOptions options) |
BigInteger |
getPrefixCount(int prefixLength)
The count of the number of distinct values within the prefix part of the address item, the bits that appear within the prefix length.
|
IPv4AddressSection |
getSection()
Gets the subsection from the series that comprises all segments
|
IPv4AddressSection |
getSection(int index)
Gets the subsection from the series starting from the given index
The first segment is at index 0.
|
IPv4AddressSection |
getSection(int index,
int endIndex)
Gets the subsection from the series starting from the given index and ending just before the give endIndex
The first segment is at index 0.
|
IPv4AddressSegment |
getSegment(int index)
Returns the segment from this series at the given index.
|
IPv4AddressSegment[] |
getSegments()
Returns the segments of this series of segments as an array.
|
void |
getSegments(Collection<? super IPv4AddressSegment> segs) |
void |
getSegments(int start,
int end,
Collection<? super IPv4AddressSegment> segs) |
IPv4AddressSection |
getUpper()
If this represents a series with ranging values, returns a series representing the upper values of the range.
|
IPv4AddressSection |
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.
|
IPv4AddressSection |
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. |
IPv4AddressSection |
insert(int index,
IPv4AddressSection other) |
IPv4AddressSection |
intersect(IPv4AddressSection other)
Produces the subnet sections whose individual sections are found in both this and the given argument.
|
int |
intValue() |
boolean |
isIPv4() |
Iterator<IPv4AddressSection> |
iterator()
Iterates through the individual address components.
|
long |
longValue() |
IPv4AddressSection |
mask(IPv4AddressSection mask)
Equivalent to
mask(IPv4AddressSection, boolean) with the second argument as false. |
IPv4AddressSection |
mask(IPv4AddressSection mask,
boolean retainPrefix)
Does the bitwise conjunction with this address.
|
IPv4AddressSection |
maskNetwork(IPv4AddressSection mask,
int networkPrefixLength)
Produces the bitwise conjunction of the given mask with the network section of the address as indicated by the given prefix length.
|
boolean |
matchesWithMask(IPAddressSection other,
IPAddressSection mask)
Applies the mask to this address section and then compares values with the given address section
|
IPv4AddressSection[] |
mergePrefixBlocks(IPv4AddressSection... sections)
Deprecated.
|
IPv4AddressSection[] |
mergeToPrefixBlocks(IPv4AddressSection... sections)
Merges this with the list of sections to produce the smallest array of prefix blocks.
|
IPv4AddressSection[] |
mergeToSequentialBlocks(IPv4AddressSection... sections)
Merges this with the list of sections to produce the smallest array of sequential block subnets.
|
Iterator<IPv4AddressSection> |
nonZeroHostIterator()
Similar to the iterator, but series with a host of zero are skipped.
|
boolean |
overlaps(AddressSection other)
Determines if one section overlaps with another.
|
Iterator<IPv4AddressSection> |
prefixBlockIterator()
Iterates through the individual prefix blocks.
|
AddressComponentSpliterator<IPv4AddressSection> |
prefixBlockSpliterator()
Partitions and traverses through the individual prefix blocks for the prefix length of this series.
|
Stream<IPv4AddressSection> |
prefixBlockStream()
Returns a sequential stream of the individual prefix blocks for the prefix length of this series.
|
boolean |
prefixContains(IPAddressSection other)
Returns whether the prefix of this address contains all values of the same bits in the given address or subnet
|
boolean |
prefixEquals(AddressSection other)
Determines if the argument section matches this section up to the prefix length of this section.
|
Iterator<IPv4AddressSection> |
prefixIterator()
Iterates through the individual prefixes.
|
AddressComponentSpliterator<IPv4AddressSection> |
prefixSpliterator()
Partitions and traverses through the individual prefixes for the prefix length of this series.
|
Stream<IPv4AddressSection> |
prefixStream()
Returns a sequential stream of the individual prefixes for the prefix length of this series.
|
IPv4AddressSection |
removePrefixLength()
Deprecated.
|
IPv4AddressSection |
removePrefixLength(boolean zeroed)
Deprecated.
|
IPv4AddressSection |
replace(int startIndex,
int endIndex,
IPv4AddressSection replacement,
int replacementStartIndex,
int replacementEndIndex)
Replaces segments starting from startIndex and ending before endIndex with the segments starting at replacementStartIndex and
ending before replacementEndIndex from the replacement section
|
IPv4AddressSection |
replace(int index,
IPv4AddressSection other)
Replace the segments of this section starting at the given index with the given replacement segments
|
IPv4AddressSection |
reverseBits(boolean perByte)
Returns a new series which has the bits reversed.
|
IPv4AddressSection |
reverseBytes()
Returns a new segment series with the bytes reversed.
|
IPv4AddressSection |
reverseBytesPerSegment()
Returns a new segment series with the bytes reversed within each segment.
|
IPv4AddressSection |
reverseSegments()
Returns a new segment series with the segments reversed.
|
Iterator<IPv4AddressSegment[]> |
segmentsIterator()
Iterates through the individual segments.
|
Iterator<IPv4AddressSegment[]> |
segmentsNonZeroHostIterator()
Similar to the segments iterator, but series with a host of zero are skipped.
|
AddressComponentRangeSpliterator<IPv4AddressSection,IPv4AddressSegment[]> |
segmentsSpliterator()
Partitions and traverses through the individual segment arrays.
|
Stream<IPv4AddressSegment[]> |
segmentsStream()
Returns a sequential stream of the individual segment arrays.
|
Iterator<IPv4AddressSection> |
sequentialBlockIterator()
Iterates through the sequential series that make up this series.
|
AddressComponentSpliterator<IPv4AddressSection> |
sequentialBlockSpliterator()
Partitions and traverses through the individual sequential blocks.
|
Stream<IPv4AddressSection> |
sequentialBlockStream()
Returns a sequential stream of the individual sequential blocks.
|
IPv4AddressSection |
setPrefixLength(int networkPrefixLength)
Sets the prefix length.
|
IPv4AddressSection |
setPrefixLength(int networkPrefixLength,
boolean withZeros)
Sets the prefix length.
|
IPv4AddressSection |
setPrefixLength(int networkPrefixLength,
boolean withZeros,
boolean zeroHostIsBlock)
Sets the prefix length while allowing the caller to control whether bits moved in or out of the prefix become zero,
and whether a zero host for the new prefix bits can be translated into a prefix block.
|
IPv4AddressSection[] |
spanWithPrefixBlocks()
Produces an array of prefix blocks that spans the same set of values.
|
IPv4AddressSection[] |
spanWithPrefixBlocks(IPv4AddressSection other)
Produces the list of prefix block subnets that span from this series to the given series.
|
IPv4AddressSection[] |
spanWithRangedSegments(IPv4AddressSection other)
Deprecated.
|
IPv4AddressSection[] |
spanWithSequentialBlocks()
Produces an array of blocks that are sequential that cover the same set of sections as this.
|
IPv4AddressSection[] |
spanWithSequentialBlocks(IPv4AddressSection other)
Produces a list of range subnets that span from this series to the given series.
|
AddressComponentSpliterator<IPv4AddressSection> |
spliterator()
Partitions and traverses through the individual address components.
|
Stream<IPv4AddressSection> |
stream()
Returns a sequential stream of the individual address components.
|
IPv4AddressSection[] |
subtract(IPv4AddressSection other)
Subtract the given subnet from this subnet, returning an array of sections for the result (the subnets will not be contiguous so an array is required).
|
IPAddressPartStringCollection |
toAllStringCollection()
Use this method with care...
|
String |
toCanonicalString()
This produces a canonical string.
|
String |
toCanonicalWildcardString()
This produces a string similar to the canonical string and avoids the CIDR prefix.
|
String |
toCompressedString()
The shortest string for IPv4 addresses is the same as the canonical string.
|
String |
toCompressedWildcardString()
This is similar to toNormalizedWildcardString, avoiding the CIDR prefix, but with compression as well.
|
IPAddressPartStringCollection |
toDatabaseSearchStringCollection()
Returns a set of strings for search the standard string representations in a database
-compress the largest compressible segments or no compression (a:0:0:c:d:0:e:f or a::c:d:0:e:f)
-upper/lowercase is not considered because many databases are case-insensitive
|
String |
toFullString()
This produces a string with no compressed segments and all segments of full length,
which is 3 characters for IPv4 segments.
|
String |
toInetAtonString(IPv4Address.inet_aton_radix radix) |
String |
toInetAtonString(IPv4Address.inet_aton_radix radix,
int joinedCount) |
IPAddressDivisionGrouping |
toJoinedSegments(int joinCount) |
IPv4AddressSection |
toMaxHost()
Returns the segment series with a host of all ones.
|
IPv4AddressSection |
toMaxHost(int prefixLength)
Produces the series with host values of all one bits for the given prefix length.
|
String |
toNormalizedString()
The normalized string returned by this method is consistent with java.net.Inet4Address,
and is the same as
toCanonicalString() . |
String |
toNormalizedString(IPAddressSection.IPStringOptions stringParams,
int joinCount) |
String |
toNormalizedWildcardString()
This produces a string similar to the normalized string and avoids the CIDR prefix.
|
IPv4AddressSection |
toPrefixBlock()
If this series has a prefix length, returns the subnet block for that prefix.
|
IPv4AddressSection |
toPrefixBlock(int networkPrefixLength)
Returns the segment series of the same length that spans all hosts.
|
String |
toPrefixLengthString()
Returns a string with a CIDR prefix length if this section has a network prefix length.
|
String |
toReverseDNSLookupString()
Generates the reverse DNS lookup string
For 8.255.4.4 it is 4.4.255.8.in-addr.arpa
For 2001:db8::567:89ab it is b.a.9.8.7.6.5.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa
|
String |
toSegmentedBinaryString()
Writes this IP address segment series as a segments of binary values preceded by the "0b" prefix.
|
String |
toSQLWildcardString()
This is the same as the string from toNormalizedWildcardString except that
it uses
Address.SEGMENT_SQL_WILDCARD instead of Address.SEGMENT_WILDCARD and also uses Address.SEGMENT_SQL_SINGLE_WILDCARD |
IPAddressPartStringCollection |
toStandardStringCollection()
Returns at most a couple dozen string representations:
-mixed (1:2:3:4:5:6:1.2.3.4)
-upper and lower case
-full compressions or no compression (a:0:0:c:d:0:e:f or a::c:d:0:e:f or a:0:b:c:d::e:f)
-full leading zeros (000a:0000:000b:000c:000d:0000:000e:000f)
-combinations thereof
|
IPAddressPartStringCollection |
toStringCollection(IPAddressSection.IPStringBuilderOptions opts) |
IPAddressPartStringCollection |
toStringCollection(IPv4AddressSection.IPv4StringBuilderOptions opts) |
String |
toSubnetString()
Produces a consistent subnet string.
|
IPv4AddressSection |
toZeroHost()
Returns the segment series with a host of zero, the host being the bits following the prefix length.
|
IPv4AddressSection |
toZeroHost(int prefixLength)
Produces the series with host values of 0 for the given prefix length.
|
IPv4AddressSection |
toZeroNetwork()
Returns the segment series with a network of zero, the network being the bits within the prefix length.
|
int |
upperIntValue() |
long |
upperLongValue() |
IPv4AddressSection |
withoutPrefixLength()
Provides the same address with no prefix.
|
bitsPerSegment, bytesPerSegment, containsNonZeroHosts, containsPrefixBlock, getBlockCount, getBlockMaskPrefixLength, getCountImpl, getMaxSegmentValue, getMinPrefixLengthForBlock, getNonZeroHostCount, getPrefixLengthForSingleBlock, getSegmentCount, getSegments, getSegments, getSegmentStrings, getSequentialBlockCount, getStartsWithSQLClause, getStartsWithSQLClause, includesMaxHost, includesMaxHost, includesZeroHost, includesZeroHost, isEntireAddress, isFullRange, isIPv6, isSingleNetwork, isSinglePrefixBlock, isZeroHost, isZeroHost, toBinaryString, toHexString, toNormalizedString, toNormalizedString, toOctalString, toString
containsSinglePrefixBlock, getLeadingBitCount, getNetworkPrefixLength, getPrefixLength, getTrailingBitCount, getZeroRangeSegments, getZeroSegments, isMore, isPrefixBlock
hashCode
getBytes, getBytes, getBytes, getCount, getDivisionCount, getDivisionStrings, getPrefixCount, getUpperBytes, getUpperBytes, getUpperBytes, getUpperValue, getValue, includesMax, includesZero, isMax, isMultiple, isPrefixed, isSequential, isZero
getPrefixLenComparator
getNetworkPrefixLength
getPrefixLength, isPrefixBlock, isPrefixed
isOneBit, testBit
getCount, getDivisionStrings, getPrefixCount, getPrefixLength, getSequentialBlockIndex, isMore, isPrefixBlock, isPrefixed, isSequential
getDivisionCount
stream, stream
public IPv4AddressSection(IPv4AddressSegment segment)
segment
- public IPv4AddressSection(IPv4AddressSegment[] segments) throws AddressValueException
AddressValueException
public IPv4AddressSection(IPv4AddressSegment[] segments, Integer networkPrefixLength) throws AddressValueException
segments
- an array containing the segments. Segments that are entirely part of the host section need not be provided, although the array must be the correct length.networkPrefixLength
- AddressValueException
public IPv4AddressSection(Address.SegmentValueProvider valueProvider, int segmentCount, Integer networkPrefixLength) throws AddressValueException
AddressValueException
public IPv4AddressSection(Address.SegmentValueProvider lowerValueProvider, Address.SegmentValueProvider upperValueProvider, int segmentCount, Integer networkPrefixLength) throws AddressValueException
AddressValueException
public IPv4AddressSection(Address.SegmentValueProvider valueProvider, int segmentCount) throws AddressValueException
AddressValueException
public IPv4AddressSection(Address.SegmentValueProvider lowerValueProvider, Address.SegmentValueProvider upperValueProvider, int segmentCount)
public IPv4AddressSection(byte[] bytes, Integer prefix) throws AddressValueException
AddressValueException
public IPv4AddressSection(byte[] bytes) throws AddressValueException
AddressValueException
public IPv4AddressSection(byte[] bytes, int byteStartIndex, int byteEndIndex, Integer prefix) throws AddressValueException
AddressValueException
public IPv4AddressSection(byte[] bytes, int byteStartIndex, int byteEndIndex) throws AddressValueException
AddressValueException
public IPv4AddressSection(int value, Integer networkPrefixLength) throws AddressValueException
AddressValueException
public IPv4AddressSection(int value)
public IPv4AddressSegment[] getSegments()
AddressSegmentSeries
AddressSegmentSeries.getSegment(int)
and AddressSegmentSeries.getSegmentCount()
instead when feasible.getSegments
in interface AddressSegmentSeries
getSegments
in interface IPAddressSegmentSeries
public IPv4AddressSection getSection()
AddressSegmentSeries
getSection
in interface AddressSegmentSeries
getSection
in interface IPAddressSegmentSeries
public IPv4AddressSection getSection(int index)
AddressSegmentSeries
getSection
in interface AddressSegmentSeries
getSection
in interface IPAddressSegmentSeries
getSection
in class IPAddressSection
public IPv4AddressSection getSection(int index, int endIndex)
AddressSegmentSeries
getSection
in interface AddressSegmentSeries
getSection
in interface IPAddressSegmentSeries
getSection
in class IPAddressSection
public IPv4AddressSection getLowerNonZeroHost()
IPAddressSegmentSeries
IPAddressSegmentSeries.getLower()
, but will not return a series that has a prefix length and whose host value is zero.
If this series has no prefix length, returns the same series as IPAddressSegmentSeries.getLower()
.getLowerNonZeroHost
in interface IPAddressSegmentSeries
getLowerNonZeroHost
in class IPAddressSection
public IPv4AddressSection getLower()
AddressSegmentSeries
getLower
in interface AddressSection
getLower
in interface AddressSegmentSeries
getLower
in interface AddressComponentRange
getLower
in interface IPAddressSegmentSeries
getLower
in class IPAddressSection
public IPv4AddressSection getUpper()
AddressSegmentSeries
getUpper
in interface AddressSection
getUpper
in interface AddressSegmentSeries
getUpper
in interface AddressComponentRange
getUpper
in interface IPAddressSegmentSeries
getUpper
in class IPAddressSection
public int intValue()
public int upperIntValue()
public long longValue()
public long upperLongValue()
public IPv4AddressSection reverseBits(boolean perByte)
IPAddressSegmentSeries
If this has an associated prefix length, then the prefix length is dropped in the reversed series.
If this represents a range of values that cannot be reversed,
because reversing the range results in a set of addresses that cannot be described by a range, then this throws IncompatibleAddressException
.
In such cases you can call IPAddressSegmentSeries.iterator()
, IPAddressSegmentSeries.getLower()
, IPAddressSegmentSeries.getUpper()
or some other method to transform the address
into an address representing a single value before reversing.
reverseBits
in interface AddressComponent
reverseBits
in interface AddressSection
reverseBits
in interface AddressSegmentSeries
reverseBits
in interface IPAddressSegmentSeries
reverseBits
in class IPAddressSection
perByte
- if true, only the bits in each byte are reversed, if false, then all bits in the address are reversedpublic IPv4AddressSection reverseBytes()
AddressSegmentSeries
reverseBytes
in interface AddressComponent
reverseBytes
in interface AddressSection
reverseBytes
in interface AddressSegmentSeries
reverseBytes
in interface IPAddressSegmentSeries
reverseBytes
in class IPAddressSection
public IPv4AddressSection reverseBytesPerSegment()
AddressSegmentSeries
reverseBytesPerSegment
in interface AddressSection
reverseBytesPerSegment
in interface AddressSegmentSeries
reverseBytesPerSegment
in interface IPAddressSegmentSeries
reverseBytesPerSegment
in class IPAddressSection
public IPv4AddressSection reverseSegments()
AddressSegmentSeries
IncompatibleAddressException
since all address series can reverse their segments.reverseSegments
in interface AddressSection
reverseSegments
in interface AddressSegmentSeries
reverseSegments
in interface IPAddressSegmentSeries
reverseSegments
in class IPAddressSection
public Iterable<IPv4AddressSection> getIterable()
AddressComponentRange
AddressComponentRange.iterator()
directly.getIterable
in interface AddressSection
getIterable
in interface AddressSegmentSeries
getIterable
in interface AddressComponentRange
getIterable
in interface IPAddressSegmentSeries
getIterable
in class IPAddressSection
public Iterator<IPv4AddressSection> nonZeroHostIterator()
IPAddressSegmentSeries
nonZeroHostIterator
in interface IPAddressSegmentSeries
nonZeroHostIterator
in class IPAddressSection
public Iterator<IPv4AddressSection> iterator()
AddressComponentRange
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, or AddressItem.getCount()
for the count.
iterator
in interface AddressSection
iterator
in interface AddressSegmentSeries
iterator
in interface AddressComponentRange
iterator
in interface IPAddressSegmentSeries
iterator
in interface Iterable<IPv4AddressSection>
iterator
in class IPAddressSection
public AddressComponentSpliterator<IPv4AddressSection> spliterator()
AddressComponentRange
spliterator
in interface AddressComponent
spliterator
in interface AddressSection
spliterator
in interface AddressSegmentSeries
spliterator
in interface AddressComponentRange
spliterator
in interface IPAddressSegmentSeries
spliterator
in interface Iterable<IPv4AddressSection>
spliterator
in class IPAddressSection
public Stream<IPv4AddressSection> stream()
AddressComponentRange
BaseStream.parallel()
on the returned stream.stream
in interface AddressSection
stream
in interface AddressSegmentSeries
stream
in interface AddressComponentRange
stream
in interface IPAddressSegmentSeries
stream
in class IPAddressSection
public Iterator<IPv4AddressSection> prefixIterator()
AddressSegmentSeries
If the series has no prefix length, then this is equivalent to AddressSegmentSeries.iterator()
prefixIterator
in interface AddressSection
prefixIterator
in interface AddressSegmentSeries
prefixIterator
in interface IPAddressSegmentSeries
prefixIterator
in class IPAddressSection
public AddressComponentSpliterator<IPv4AddressSection> prefixSpliterator()
AddressSegmentSeries
prefixSpliterator
in interface AddressSection
prefixSpliterator
in interface AddressSegmentSeries
prefixSpliterator
in interface IPAddressSegmentSeries
prefixSpliterator
in class IPAddressSection
public Stream<IPv4AddressSection> prefixStream()
AddressSegmentSeries
BaseStream.parallel()
on the returned stream.prefixStream
in interface AddressSection
prefixStream
in interface AddressSegmentSeries
prefixStream
in interface IPAddressSegmentSeries
prefixStream
in class IPAddressSection
public Iterator<IPv4AddressSection> prefixBlockIterator()
AddressSegmentSeries
If the series has no prefix length, then this is equivalent to AddressSegmentSeries.iterator()
prefixBlockIterator
in interface AddressSection
prefixBlockIterator
in interface AddressSegmentSeries
prefixBlockIterator
in interface IPAddressSegmentSeries
prefixBlockIterator
in class IPAddressSection
public AddressComponentSpliterator<IPv4AddressSection> prefixBlockSpliterator()
AddressSegmentSeries
prefixBlockSpliterator
in interface AddressSection
prefixBlockSpliterator
in interface AddressSegmentSeries
prefixBlockSpliterator
in interface IPAddressSegmentSeries
prefixBlockSpliterator
in class IPAddressSection
public Stream<IPv4AddressSection> prefixBlockStream()
AddressSegmentSeries
BaseStream.parallel()
on the returned stream.prefixBlockStream
in interface AddressSection
prefixBlockStream
in interface AddressSegmentSeries
prefixBlockStream
in interface IPAddressSegmentSeries
prefixBlockStream
in class IPAddressSection
public Iterator<IPv4AddressSection> blockIterator(int segmentCount)
IPAddressSegmentSeries
For instance, given the IPv4 subnet 1-2.3-4.5-6.7, given the count argument 2, it will iterate through 1.3.5-6.7, 1.4.5-6.7, 2.3.5-6.7, 2.4.5-6.7
blockIterator
in interface IPAddressSegmentSeries
blockIterator
in class IPAddressSection
public AddressComponentSpliterator<IPv4AddressSection> blockSpliterator(int segmentCount)
IPAddressSegmentSeries
blockSpliterator
in interface IPAddressSegmentSeries
blockSpliterator
in class IPAddressSection
public Stream<IPv4AddressSection> blockStream(int segmentCount)
IPAddressSegmentSeries
BaseStream.parallel()
on the returned stream.blockStream
in interface IPAddressSegmentSeries
blockStream
in class IPAddressSection
public Iterator<IPv4AddressSection> sequentialBlockIterator()
IPAddressSegmentSeries
IPAddressSegmentSeries.blockIterator(int)
with that segment count.
For instance, given the IPv4 subnet 1-2.3-4.5-6.7-8, it will iterate through 1.3.5.7-8, 1.3.6.7-8, 1.4.5.7-8, 1.4.6.7-8, 2.3.5.7-8, 2.3.6.7-8, 2.4.6.7-8, 2.4.6.7-8.
Use IPAddressSegmentSeries.getSequentialBlockCount()
to get the count of iterated elements.
sequentialBlockIterator
in interface IPAddressSegmentSeries
sequentialBlockIterator
in class IPAddressSection
public AddressComponentSpliterator<IPv4AddressSection> sequentialBlockSpliterator()
IPAddressSegmentSeries
sequentialBlockSpliterator
in interface IPAddressSegmentSeries
sequentialBlockSpliterator
in class IPAddressSection
public Stream<IPv4AddressSection> sequentialBlockStream()
IPAddressSegmentSeries
BaseStream.parallel()
on the returned stream.
Use IPAddressSegmentSeries.getSequentialBlockCount()
to get the count of streamed elements.
sequentialBlockStream
in interface IPAddressSegmentSeries
sequentialBlockStream
in class IPAddressSection
public Iterator<IPv4AddressSegment[]> segmentsNonZeroHostIterator()
IPAddressSegmentSeries
segmentsNonZeroHostIterator
in interface IPAddressSegmentSeries
public Iterator<IPv4AddressSegment[]> segmentsIterator()
AddressSegmentSeries
segmentsIterator
in interface AddressSegmentSeries
segmentsIterator
in interface IPAddressSegmentSeries
public AddressComponentRangeSpliterator<IPv4AddressSection,IPv4AddressSegment[]> segmentsSpliterator()
AddressSegmentSeries
segmentsSpliterator
in interface AddressSegmentSeries
segmentsSpliterator
in interface IPAddressSegmentSeries
public Stream<IPv4AddressSegment[]> segmentsStream()
AddressSegmentSeries
BaseStream.parallel()
on the returned stream.segmentsStream
in interface AddressSegmentSeries
segmentsStream
in interface IPAddressSegmentSeries
public IPv4AddressSection incrementBoundary(long increment)
AddressSegmentSeries
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.
incrementBoundary
in interface AddressSection
incrementBoundary
in interface AddressSegmentSeries
incrementBoundary
in interface IPAddressSegmentSeries
incrementBoundary
in class IPAddressSection
public IPv4AddressSection increment(long increment)
AddressSegmentSeries
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.
increment
in interface AddressSection
increment
in interface AddressSegmentSeries
increment
in interface IPAddressSegmentSeries
increment
in class IPAddressSection
public long getIPv4Count(boolean excludeZeroHosts)
public long getIPv4PrefixCount(int prefixLength)
public BigInteger getPrefixCount(int prefixLength)
AddressItem
getPrefixCount
in interface AddressDivisionSeries
getPrefixCount
in interface AddressItem
public long getIPv4PrefixCount()
public IPv4AddressSegment getDivision(int index)
getDivision
in interface AddressDivisionSeries
getDivision
in interface IPAddressDivisionSeries
getDivision
in interface AddressStringDivisionSeries
getDivision
in interface IPAddressStringDivisionSeries
getDivision
in class IPAddressSection
public IPv4AddressSegment getSegment(int index)
AddressSegmentSeries
AddressDivisionSeries.getDivision(int)
, the difference being that all segments in a given series are the same bit count, while divisions can have variable length.getSegment
in interface AddressSegmentSeries
getSegment
in interface IPAddressSegmentSeries
getSegment
in class IPAddressSection
public void getSegments(Collection<? super IPv4AddressSegment> segs)
public void getSegments(int start, int end, Collection<? super IPv4AddressSegment> segs)
public int getBitsPerSegment()
AddressSegmentSeries
getBitsPerSegment
in interface AddressSegmentSeries
public int getBytesPerSegment()
AddressSegmentSeries
getBytesPerSegment
in interface AddressSegmentSeries
public int getBitCount()
AddressItem
getBitCount
in interface AddressDivisionSeries
getBitCount
in interface AddressItem
getBitCount
in class IPAddressSection
public int getByteCount()
AddressItem
getByteCount
in interface AddressItem
getByteCount
in class IPAddressSection
public boolean isIPv4()
isIPv4
in class IPAddressSection
public IPAddress.IPVersion getIPVersion()
IPAddressSegmentSeries
getIPVersion
in interface IPAddressSegmentSeries
public boolean matchesWithMask(IPAddressSection other, IPAddressSection mask)
IPAddressSection
matchesWithMask
in class IPAddressSection
public boolean equals(Object o)
AddressDivisionGroupingBase
equals
in class IPAddressDivisionGrouping
public boolean overlaps(AddressSection other)
AddressSection
Sections must have the same number of segments to be comparable.
For sections which are aware of their position in an address (IPv6 and MAC), their respective positions must match to be comparable.
overlaps
in interface AddressSection
public boolean contains(AddressSection other)
AddressSection
Sections must have the same number of segments to be comparable.
For sections which are aware of their position in an address (IPv6 and MAC), their respective positions must match to be comparable.
contains
in interface AddressSection
contains
in class IPAddressSection
public Long enumerateIPv4(IPv4AddressSection other)
Equivalent to enumerate(AddressSection)
but returns a Long rather than a BigInteger.
public BigInteger enumerate(AddressSection other)
AddressSection
Determines how many address section elements precede the given address section element, if the given address section is within this address section. If above the range, it is the distance to the upper boundary added to the address section count, and if below the range, the distance to the lower boundary.
In other words, if the given address section is not in this section but above it, returns the number of individual address sections preceding the given address section from the upper section boundary, added to the total number of individual address sections within. If the given address section is not in this section but below it, returns the number of individual address sections following the given address section to the lower section boundary.
enumerate returns null when the argument is a multi-valued section. The argument must be an individual address section.
When this address section is also single-valued, the returned value is the distance (difference) between this address section and the argument address section.
enumerate is the inverse of the increment method:
enumerate
in interface AddressSection
public boolean prefixEquals(AddressSection other)
AddressSection
The entire prefix of this section must be present in the other section to be comparable.
For sections which are aware of their position in an address (IPv6 and MAC), the argument section must have the same or an earlier position in the address to match all prefix segments of this section, and the matching is lined up relative to the position.
prefixEquals
in interface AddressSection
public boolean prefixContains(IPAddressSection other)
IPAddressSection
prefixContains
in class IPAddressSection
public IPv4AddressSection append(IPv4AddressSection other)
public IPv4AddressSection insert(int index, IPv4AddressSection other)
public IPv4AddressSection replace(int index, IPv4AddressSection other)
index
- other
- public IPv4AddressSection appendToNetwork(IPv4AddressSection other)
public IPv4AddressSection replace(int startIndex, int endIndex, IPv4AddressSection replacement, int replacementStartIndex, int replacementEndIndex)
startIndex
- endIndex
- replacement
- replacementStartIndex
- replacementEndIndex
- IndexOutOfBoundsException
IncompatibleAddressException
- if the resulting section would exceed the maximum segment count for this address type and versionpublic IPv4AddressSection intersect(IPv4AddressSection other) throws SizeMismatchException
This is also known as the conjunction of the two sets of address sections.
other
- SizeMismatchException
public IPv4AddressSection[] subtract(IPv4AddressSection other) throws SizeMismatchException
Computes the subnet difference, the set of addresses in this address section but not in the provided section. This is also known as the relative complement of the given argument in this subnet.
Keep in mind this is set subtraction, not subtraction of segment values. We have a subnet of addresses and we are removing some of those addresses.
other
- SizeMismatchException
- if the two sections are different sizespublic IPv4AddressNetwork getNetwork()
AddressComponent
getNetwork
in interface AddressComponent
getNetwork
in interface IPAddressStringDivisionSeries
getNetwork
in interface IPAddressSegmentSeries
getNetwork
in class IPAddressDivisionGrouping
public IPv4AddressSection adjustPrefixBySegment(boolean nextSegment)
AddressSegmentSeries
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, use AddressSegmentSeries.adjustPrefixBySegment(boolean, boolean)
with second arg false.
adjustPrefixBySegment
in interface AddressSection
adjustPrefixBySegment
in interface AddressSegmentSeries
adjustPrefixBySegment
in interface IPAddressSegmentSeries
adjustPrefixBySegment
in class IPAddressSection
nextSegment
- whether to move prefix to previous or following segment boundarypublic IPv4AddressSection adjustPrefixBySegment(boolean nextSegment, boolean zeroed)
AddressSegmentSeries
adjustPrefixBySegment
in interface AddressSection
adjustPrefixBySegment
in interface AddressSegmentSeries
adjustPrefixBySegment
in interface IPAddressSegmentSeries
adjustPrefixBySegment
in class IPAddressSection
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 valuespublic IPv4AddressSection adjustPrefixLength(int adjustment)
AddressSegmentSeries
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.
adjustPrefixLength
in interface AddressSection
adjustPrefixLength
in interface AddressSegmentSeries
adjustPrefixLength
in interface IPAddressSegmentSeries
adjustPrefixLength
in class IPAddressSection
public IPv4AddressSection adjustPrefixLength(int adjustment, boolean zeroed)
AddressSegmentSeries
adjustPrefixLength
in interface AddressSection
adjustPrefixLength
in interface AddressSegmentSeries
adjustPrefixLength
in interface IPAddressSegmentSeries
adjustPrefixLength
in class IPAddressSection
adjustment
- the incrementzeroed
- whether the bits that move from one side of the prefix to the other become zero or retain their original values@Deprecated public IPv4AddressSection applyPrefixLength(int networkPrefixLength)
AddressSegmentSeries
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.
applyPrefixLength
in interface AddressSection
applyPrefixLength
in interface AddressSegmentSeries
applyPrefixLength
in interface IPAddressSegmentSeries
applyPrefixLength
in class IPAddressSection
AddressSegmentSeries.setPrefixLength(int)
public IPv4AddressSection setPrefixLength(int networkPrefixLength)
AddressSegmentSeries
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.
setPrefixLength
in interface AddressSection
setPrefixLength
in interface AddressSegmentSeries
setPrefixLength
in interface IPAddressSegmentSeries
setPrefixLength
in class IPAddressSection
public IPv4AddressSection setPrefixLength(int networkPrefixLength, boolean withZeros)
AddressSegmentSeries
When the prefix is extended beyond the segment series boundary, it is removed.
setPrefixLength
in interface AddressSection
setPrefixLength
in interface AddressSegmentSeries
setPrefixLength
in interface IPAddressSegmentSeries
setPrefixLength
in class IPAddressSection
withZeros
- 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.public IPv4AddressSection setPrefixLength(int networkPrefixLength, boolean withZeros, boolean zeroHostIsBlock) throws PrefixLenException
IPAddressSection
IPAddressSection.setPrefixLength(int, boolean)
and IPAddressSection.setPrefixLength(int)
use a value of true for zeroed and for zeroHostIsBlock.
For example, when zeroHostIsBlock is true, applying to 1.2.0.0 the prefix length 16 results in 1.2.*.*/16
Or if you start with 1.2.0.0/24, setting the prefix length to 16 results in a zero host followed by the existing prefix block, which is then converted to a full prefix block, 1.2.*.*/16
When both zeroed and zeroHostIsBlock are true, applying the prefix length of 16 to 1.2.4.0/24 also results in a zero host followed by the existing prefix block, which is then converted to a full prefix block, 1.2.*.*/16.
When both zeroed and zeroHostIsBlock are false, the resulting address always encompasses the same set of addresses as the original, albeit with a different prefix length.
setPrefixLength
in class IPAddressSection
PrefixLenException
@Deprecated public IPv4AddressSection removePrefixLength()
AddressSegmentSeries
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)
removePrefixLength
in interface AddressSection
removePrefixLength
in interface AddressSegmentSeries
removePrefixLength
in interface IPAddressSegmentSeries
removePrefixLength
in class IPAddressSection
for an alternative which does not change the address series values.
public IPv4AddressSection withoutPrefixLength()
AddressSegmentSeries
Use AddressSegmentSeries.removePrefixLength()
as an alternative that deletes the host at the same time by zeroing the host values.
withoutPrefixLength
in interface AddressSection
withoutPrefixLength
in interface AddressSegmentSeries
withoutPrefixLength
in interface IPAddressSegmentSeries
withoutPrefixLength
in class IPAddressSection
@Deprecated public IPv4AddressSection removePrefixLength(boolean zeroed)
AddressSegmentSeries
AddressSegmentSeries.removePrefixLength()
removePrefixLength
in interface AddressSection
removePrefixLength
in interface AddressSegmentSeries
removePrefixLength
in interface IPAddressSegmentSeries
removePrefixLength
in class IPAddressSection
zeroed
- whether the bits outside the prefix become zeropublic IPv4AddressSection toZeroHost() throws IncompatibleAddressException
IPAddressSegmentSeries
The default behaviour is that the resultant series will have the same prefix length.
The resultant series will not have a prefix length if AddressNetwork.getPrefixConfiguration()
is AddressNetwork.PrefixConfiguration.ALL_PREFIXED_ADDRESSES_ARE_SUBNETS
.
For instance, you can get the network address for a subnet as follows:
String addrStr = "1.2.3.4/16";
IPAddress address = new IPAddressString(addrStr).getAddress();
IPAddress networkAddress = address.toZeroHost(); //1.2.0.0
toZeroHost
in interface IPAddressSegmentSeries
toZeroHost
in class IPAddressSection
IncompatibleAddressException
IPAddressSegmentSeries.toZeroNetwork()
public IPv4AddressSection toZeroHost(int prefixLength)
IPAddressSegmentSeries
If this series has the same prefix length, then the resulting series will too, otherwise the resulting series will have no prefix length.
This is nearly equivalent to doing the mask (bitwise conjunction) of this address series with the network mask for the given prefix length, but without the possibility of IncompatibleAddressException that can occur when applying a mask to a range of values. Instead, in this case, if the resulting series has a range of values, then the resulting series range boundaries will have host values of 0, but not necessarily the intervening values.
For instance, you can get the network address for a subnet of prefix length 16 as follows:
String addrStr = "1.2.3.4";
IPAddress address = new IPAddressString(addrStr).getAddress();
IPAddress networkAddress = address.toZeroHost(16); //1.2.0.0
toZeroHost
in interface IPAddressSegmentSeries
toZeroHost
in class IPAddressSection
public IPv4AddressSection toZeroNetwork()
IPAddressSegmentSeries
The default behaviour is that the resultant series will have the same prefix length.
The resultant series will not have a prefix length if AddressNetwork.getPrefixConfiguration()
is AddressNetwork.PrefixConfiguration.ALL_PREFIXED_ADDRESSES_ARE_SUBNETS
.
toZeroNetwork
in interface IPAddressSegmentSeries
toZeroNetwork
in class IPAddressSection
IPAddressSegmentSeries.toZeroHost()
public IPv4AddressSection toMaxHost() throws IncompatibleAddressException
IPAddressSegmentSeries
The resultant series will have the same prefix length if AddressNetwork.getPrefixConfiguration()
is not AddressNetwork.PrefixConfiguration.ALL_PREFIXED_ADDRESSES_ARE_SUBNETS
,
otherwise it will no longer have a prefix length.
For instance, you can get the broadcast address for a subnet as follows:
String addrStr = "1.2.3.4/16";
IPAddress address = new IPAddressString(addrStr).getAddress();
IPAddress broadcastAddress = address.toMaxHost(); //1.2.255.255
toMaxHost
in interface IPAddressSegmentSeries
toMaxHost
in class IPAddressSection
IncompatibleAddressException
public IPv4AddressSection createMaxHost()
public IPv4AddressSection toMaxHost(int prefixLength)
IPAddressSegmentSeries
If this series has the same prefix length, then the resulting series will too, otherwise the resulting series will have no prefix length.
This is nearly equivalent to doing the bitwise or (bitwise disjunction) of this address series with the network mask for the given prefix length, but without the possibility of IncompatibleAddressException that can occur when applying a mask to a range of values. Instead, in this case, if the resulting series has a range of values, then the resulting series range boundaries will have host values of all ones, but not necessarily the intervening values.
For instance, you can get the broadcast address for a subnet of prefix length 16 as follows:
String addrStr = "1.2.3.4";
IPAddress address = new IPAddressString(addrStr).getAddress();
IPAddress broadcastAddress = address.toMaxHost(16); //1.2.255.255
toMaxHost
in interface IPAddressSegmentSeries
toMaxHost
in class IPAddressSection
public IPv4AddressSection mask(IPv4AddressSection mask, boolean retainPrefix) throws IncompatibleAddressException, SizeMismatchException
mask
- retainPrefix
- whether to drop the prefixIncompatibleAddressException
SizeMismatchException
public IPv4AddressSection mask(IPv4AddressSection mask) throws IncompatibleAddressException, SizeMismatchException
mask(IPv4AddressSection, boolean)
with the second argument as false.public IPv4AddressSection maskNetwork(IPv4AddressSection mask, int networkPrefixLength) throws IncompatibleAddressException, PrefixLenException, SizeMismatchException
bitwiseOr(IPv4AddressSection)
or replace(int, IPv4AddressSection)
mask
- networkPrefixLength
- IncompatibleAddressException
PrefixLenException
SizeMismatchException
public IPv4AddressSection bitwiseOr(IPv4AddressSection mask) throws IncompatibleAddressException
bitwiseOr(IPv4AddressSection, boolean)
with the second argument as false.IncompatibleAddressException
public IPv4AddressSection bitwiseOr(IPv4AddressSection mask, boolean retainPrefix) throws IncompatibleAddressException, SizeMismatchException
mask(IPv4AddressSection)
which does the bitwise conjunction.retainPrefix
- whether the result will retain the same prefix length as this.IncompatibleAddressException
SizeMismatchException
public IPv4AddressSection bitwiseOrNetwork(IPv4AddressSection mask, int networkPrefixLength) throws IncompatibleAddressException, SizeMismatchException
maskNetwork(IPv4AddressSection, int)
which does the bitwise conjunction.
Any existing prefix length is dropped for the new prefix length and the disjunction is applied up to the end the new prefix length.
mask
- IncompatibleAddressException
SizeMismatchException
public IPv4AddressSection getHostMask()
IPAddressSegmentSeries
getHostMask
in interface IPAddressSegmentSeries
getHostMask
in class IPAddressSection
public IPv4AddressSection getNetworkMask()
IPAddressSegmentSeries
getNetworkMask
in interface IPAddressSegmentSeries
getNetworkMask
in class IPAddressSection
public IPv4AddressSection getNetworkSection()
IPAddressSegmentSeries
getNetworkSection
in interface IPAddressSegmentSeries
public IPv4AddressSection getNetworkSection(int networkPrefixLength) throws PrefixLenException
IPAddressSegmentSeries
getNetworkSection
in interface IPAddressSegmentSeries
PrefixLenException
public IPv4AddressSection getNetworkSection(int networkPrefixLength, boolean withPrefixLength) throws PrefixLenException
IPAddressSegmentSeries
getNetworkSection
in interface IPAddressSegmentSeries
withPrefixLength
- whether the resulting section will have networkPrefixLength as the associated prefix length or notPrefixLenException
public IPv4AddressSection getHostSection()
IPAddressSegmentSeries
getHostSection
in interface IPAddressSegmentSeries
public IPv4AddressSection getHostSection(int networkPrefixLength) throws PrefixLenException
IPAddressSegmentSeries
getHostSection
in interface IPAddressSegmentSeries
PrefixLenException
public IPv4AddressSection toPrefixBlock()
IPAddressSegmentSeries
toPrefixBlock
in interface AddressSection
toPrefixBlock
in interface AddressSegmentSeries
toPrefixBlock
in interface IPAddressSegmentSeries
toPrefixBlock
in class IPAddressSection
public IPv4AddressSection toPrefixBlock(int networkPrefixLength) throws PrefixLenException
IPAddressSegmentSeries
toPrefixBlock
in interface IPAddressSegmentSeries
toPrefixBlock
in class IPAddressSection
PrefixLenException
public IPv4AddressSection assignPrefixForSingleBlock()
IPAddressSection
If no such prefix length exists, returns null.
If this address represents just a single address, "this" is returned.
assignPrefixForSingleBlock
in interface IPAddressSegmentSeries
assignPrefixForSingleBlock
in class IPAddressSection
IPAddressSegmentSeries.toPrefixBlock()
,
IPAddressSegmentSeries.assignMinPrefixForBlock()
public IPv4AddressSection assignMinPrefixForBlock()
IPAddressSection
assignMinPrefixForBlock
in interface IPAddressSegmentSeries
assignMinPrefixForBlock
in class IPAddressSection
IPAddressSegmentSeries.toPrefixBlock()
,
IPAddressSegmentSeries.assignPrefixForSingleBlock()
public IPv4AddressSection coverWithPrefixBlock()
IPAddressSegmentSeries
coverWithPrefixBlock
in interface IPAddressSegmentSeries
coverWithPrefixBlock
in class IPAddressSection
public IPv4AddressSection coverWithPrefixBlock(IPv4AddressSection other) throws AddressConversionException
AddressConversionException
public IPv4AddressSection[] spanWithPrefixBlocks()
Unlike spanWithPrefixBlocks(IPv4AddressSection)
this method only includes blocks that are a part of this section.
spanWithPrefixBlocks
in interface IPAddressSegmentSeries
public IPv4AddressSection[] spanWithPrefixBlocks(IPv4AddressSection other)
other
- @Deprecated public IPv4AddressSection[] spanWithRangedSegments(IPv4AddressSection other)
spanWithSequentialBlocks(IPv4AddressSection)
other
- public IPv4AddressSection[] spanWithSequentialBlocks() throws AddressConversionException
This array can be shorter than that produced by spanWithPrefixBlocks()
and is never longer.
Unlike spanWithSequentialBlocks(IPv4AddressSection)
this method only includes values that are a part of this section.
spanWithSequentialBlocks
in interface IPAddressSegmentSeries
AddressConversionException
public IPv4AddressSection[] spanWithSequentialBlocks(IPv4AddressSection other)
other
- @Deprecated public IPv4AddressSection[] mergePrefixBlocks(IPv4AddressSection... sections) throws SizeMismatchException
mergeToPrefixBlocks(IPv4AddressSection...)
sections
- SizeMismatchException
public IPv4AddressSection[] mergeToPrefixBlocks(IPv4AddressSection... sections) throws SizeMismatchException
The resulting array is sorted from lowest address value to highest, regardless of the size of each prefix block.
In version 5.3.1 and earlier, the result was sorted from single address to smallest blocks to largest blocks.
For that ordering, sort with IPAddressSegmentSeries.getPrefixLenComparator()
:
Arrays.sort(result, IPAddressSegmentSeries.getPrefixLenComparator());
sections
- the sections to merge with thisSizeMismatchException
public IPv4AddressSection[] mergeToSequentialBlocks(IPv4AddressSection... sections) throws SizeMismatchException
The resulting array is sorted by lower address, regardless of the size of each prefix block.
In version 5.3.1 and earlier, the result was sorted from single address to smallest blocks to largest blocks.
For that ordering, sort with IPAddressSegmentSeries.getPrefixLenComparator()
:
Arrays.sort(result, IPAddressSegmentSeries.getPrefixLenComparator());
sections
- the sections to merge with thisSizeMismatchException
public String toCanonicalString()
toCanonicalString
in interface AddressSegmentSeries
public String toFullString()
toFullString
in interface IPAddressSegmentSeries
public String toCompressedString()
toCompressedString
in interface AddressSegmentSeries
public String toNormalizedString()
toCanonicalString()
.toNormalizedString
in interface AddressComponent
public String toCompressedWildcardString()
IPAddressSegmentSeries
toCompressedWildcardString
in interface IPAddressSegmentSeries
public String toSubnetString()
IPAddressSegmentSeries
toSubnetString
in interface IPAddressSegmentSeries
public String toPrefixLengthString()
IPAddressSegmentSeries
toPrefixLengthString
in interface IPAddressSegmentSeries
public String toInetAtonString(IPv4Address.inet_aton_radix radix)
public String toInetAtonString(IPv4Address.inet_aton_radix radix, int joinedCount) throws IncompatibleAddressException
IncompatibleAddressException
public String toNormalizedWildcardString()
IPAddressSegmentSeries
toNormalizedWildcardString
in interface IPAddressSegmentSeries
public String toCanonicalWildcardString()
IPAddressSegmentSeries
toCanonicalWildcardString
in interface IPAddressSegmentSeries
public String toSQLWildcardString()
IPAddressSegmentSeries
Address.SEGMENT_SQL_WILDCARD
instead of Address.SEGMENT_WILDCARD
and also uses Address.SEGMENT_SQL_SINGLE_WILDCARD
toSQLWildcardString
in interface IPAddressSegmentSeries
public String toReverseDNSLookupString()
IPAddressSegmentSeries
toReverseDNSLookupString
in interface IPAddressSegmentSeries
public String toSegmentedBinaryString()
IPAddressSegmentSeries
toSegmentedBinaryString
in interface IPAddressSegmentSeries
public String toNormalizedString(IPAddressSection.IPStringOptions stringParams, int joinCount) throws IncompatibleAddressException
IncompatibleAddressException
public IPAddressDivisionGrouping toJoinedSegments(int joinCount)
public IPAddressPartStringCollection toAllStringCollection()
IPAddressSection
toAllStringCollection
in class IPAddressSection
public IPAddressPartStringCollection toStandardStringCollection()
IPAddressSection
toStandardStringCollection
in class IPAddressSection
public IPAddressPartStringCollection toDatabaseSearchStringCollection()
IPAddressSection
toDatabaseSearchStringCollection
in class IPAddressSection
public IPAddressPartStringCollection toStringCollection(IPAddressSection.IPStringBuilderOptions opts)
toStringCollection
in interface IPAddressSegmentSeries
public IPAddressPartStringCollection toStringCollection(IPv4AddressSection.IPv4StringBuilderOptions opts)
public IPAddressStringDivisionSeries[] getParts(IPAddressSection.IPStringBuilderOptions options)
IPAddressSection
IPAddressDivisionGrouping
getParts
in class IPAddressSection
public IPAddressStringDivisionSeries[] getParts(IPv4AddressSection.IPv4StringBuilderOptions options)